From 3a5a34da0abc21c93e520e61cea6dfe3220a513b Mon Sep 17 00:00:00 2001 From: Oscar Rodriguez Date: Thu, 6 Mar 2014 12:06:57 +0100 Subject: [PATCH] dal.py: Table class: validate_and_update_or_insert method created, and minor changes in validate_and_update --- gluon/dal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gluon/dal.py b/gluon/dal.py index ba83a02f..4a41fe10 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -9205,7 +9205,11 @@ class Table(object): if record: response = self.validate_and_update(_key, **fields) - response.id = {'id': self(**fields).id} + # Now primary key must be returned + primary_keys = {} + for key in self._primarykey: + primary_keys[key] = getattr(record, key) + response.id = primary_keys else: response = self.validate_and_insert(**fields) return response