From 6097a00bf136413d6be26092510d345ae6741a96 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 1 Sep 2013 09:35:30 -0500 Subject: [PATCH] possibly fixed issue 1637:when trying to use IS_IN_DB with a composite reference key, there is a no _id error reported --- VERSION | 2 +- gluon/dal.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 497bbb0c..fa9cee3a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.09.01.08.06.40 +Version 2.6.0-development+timestamp.2013.09.01.09.34.39 diff --git a/gluon/dal.py b/gluon/dal.py index 1edd16b8..44ee1d61 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -690,7 +690,11 @@ class BaseAdapter(ConnectionPool): return isinstance(exception, self.driver.ProgrammingError) def id_query(self, table): - return table._id != None + pkeys = getattr(table,'_primarykey',None) + if pkeys: + return table[pkeys[0]] != None + else: + return table._id != None def adapt(self, obj): return "'%s'" % obj.replace("'", "''")