From 2cdcdaf9320146a6904b9d57da46dc8053a47eff Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 15 Aug 2013 09:21:58 -0500 Subject: [PATCH] possibly fixed Issue 1630:memdb id error -- tries casting None to long., thanks Luca --- VERSION | 2 +- gluon/contrib/memdb.py | 5 ++--- gluon/globals.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index cf73e38f..e95fe15e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.08.15.09.08.28 +Version 2.6.0-development+timestamp.2013.08.15.09.21.06 diff --git a/gluon/contrib/memdb.py b/gluon/contrib/memdb.py index 6396cfe2..f619bdeb 100644 --- a/gluon/contrib/memdb.py +++ b/gluon/contrib/memdb.py @@ -502,9 +502,8 @@ class Query(object): 'Query: right side of filter must be a value or entity') if isinstance(left, Field) and left.name == 'id': if op == '=': - self.get_one = \ - QueryException(tablename=left._tablename, - id=long(right)) + self.get_one = QueryException( + tablename=left._tablename, id=long(right or 0)) return else: raise SyntaxError('only equality by id is supported') diff --git a/gluon/globals.py b/gluon/globals.py index 9798cb1a..1f856f90 100644 --- a/gluon/globals.py +++ b/gluon/globals.py @@ -741,7 +741,7 @@ class Session(Storage): if record_id == '0': raise Exception('record_id == 0') # Select from database - row = db(table.id == record_id).select() + row = record_id and db(table.id == record_id).select() row = row and row[0] or None # Make sure the session data exists in the database if not row or row.unique_key != unique_key: