From 241a5e0694de4878ce30fa0adfda133a1a3e24d4 Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Sun, 6 May 2012 16:05:13 -0500 Subject: [PATCH] closed github issue 5, thanks MoMaT --- VERSION | 2 +- gluon/dal.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index fc9c4c8c..7a8798da 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.7 (2012-05-06 16:00:34) dev +Version 1.99.7 (2012-05-06 16:05:07) dev diff --git a/gluon/dal.py b/gluon/dal.py index 42ab2f5f..582bdc1b 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -4164,10 +4164,11 @@ class GoogleDatastoreAdapter(NoSQLAdapter): def select(self,query,fields,attributes): (items, tablename, fields) = self.select_raw(query,fields,attributes) # self.db['_lastsql'] = self._select(query,fields,attributes) - rows = [ - [t=='id' and (int(item.key().id()) if item.key().id() else - item.key().name()) or getattr(item, t) for t in fields] - for item in items] + rows = [] + for item in items: + rows.append([ + t=='id' and item.key().id_or_name() or getattr(item, t) \ + for t in fields]) colnames = ['%s.%s' % (tablename, t) for t in fields] processor = attributes.get('processor',self.parse) return processor(rows,fields,colnames,False) @@ -7178,7 +7179,7 @@ class Table(dict): if rows: return rows[0] return None - elif str(key).isdigit(): + elif str(key).isdigit() or isinstance(key, Key): return self._db(self._id == key).select(limitby=(0,1)).first() elif key: return dict.__getitem__(self, str(key))