made sury listify is called after table._before_*

This commit is contained in:
Massimo Di Pierro committed 2012-03-16 12:41:28 -05:00
1 parent 4600da0954
commit 570fa5884b
2 files changed
+5 -7

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 1.99.7 (2012-03-16 12:33:04) dev Version 1.99.7 (2012-03-16 12:41:06) dev
+4 -6
View File
@@ -7608,10 +7608,9 @@ class Set(object):
def update(self, **update_fields): def update(self, **update_fields):
tablename = self.db._adapter.get_table(self.query) tablename = self.db._adapter.get_table(self.query)
table = self.db[tablename] table = self.db[tablename]
fields = table._listify(update_fields,update=True)
if not fields:
raise SyntaxError, "No fields to update"
[f(self,update_fields) for f in table._before_update] [f(self,update_fields) for f in table._before_update]
fields = table._listify(update_fields,update=True)
if not fields: raise SyntaxError, "No fields to update"
ret = self.db._adapter.update(tablename,self.query,fields) ret = self.db._adapter.update(tablename,self.query,fields)
ret and [f(self,update_fields) for f in table._after_update] ret and [f(self,update_fields) for f in table._after_update]
return ret return ret
@@ -7628,13 +7627,12 @@ class Set(object):
else: else:
new_fields[key] = value new_fields[key] = value
table = self.db[tablename] table = self.db[tablename]
fields = table._listify(new_fields,update=True)
if not fields:
raise SyntaxError, "No fields to update"
if response.errors: if response.errors:
response.updated = None response.updated = None
else: else:
[f(self,new_fields) for f in table._before_update] [f(self,new_fields) for f in table._before_update]
fields = table._listify(new_fields,update=True)
if not fields: raise SyntaxError, "No fields to update"
ret = self.db._adapter.update(tablename,self.query,fields) ret = self.db._adapter.update(tablename,self.query,fields)
ret and [f(self,new_fields) for f in table._after_update] ret and [f(self,new_fields) for f in table._after_update]
response.update = ret response.update = ret