From fd000fe35b87749830d8ab8581461153aaab7b30 Mon Sep 17 00:00:00 2001 From: Massimo Date: Tue, 3 Sep 2013 09:53:42 -0500 Subject: [PATCH] preventing un-necessary fetch, thans Anthony and Villas --- VERSION | 2 +- gluon/dal.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 6170e86f..bc7a475e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.09.02.20.41.19 +Version 2.6.0-development+timestamp.2013.09.03.09.52.37 diff --git a/gluon/dal.py b/gluon/dal.py index 4ba211b0..d87cbc19 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -8212,8 +8212,12 @@ class Reference(long): def __getattr__(self, key): if key == 'id': return long(self) - self.__allocate() - return self._record.get(key, None) + if key in self._table: + self.__allocate() + if self._record: + return self._record.get(key,None) # to deal with case self.update_record() + else: + return None def get(self, key, default=None): return self.__getattr__(key, default)