[SQL-CVS] r2765 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2007-07-19 13:18:11
|
Author: phd Date: 2007-07-19 07:18:07 -0600 (Thu, 19 Jul 2007) New Revision: 2765 Modified: SQLObject/trunk/sqlobject/main.py Log: A patch by Andy Grover <an...@gr...>: Suppress the second RowUpdateSignal in .set() called from ._SO_setValue(). Modified: SQLObject/trunk/sqlobject/main.py =================================================================== --- SQLObject/trunk/sqlobject/main.py 2007-07-19 13:17:27 UTC (rev 2764) +++ SQLObject/trunk/sqlobject/main.py 2007-07-19 13:18:07 UTC (rev 2765) @@ -1044,7 +1044,11 @@ if not self.sqlmeta._creating: self.sqlmeta.send(events.RowUpdateSignal, self, d) if len(d) != 1 or name not in d: - return self.set(**d) + # Already called RowUpdateSignal, don't call it again + # inside .set() + self.sqlmeta.row_update_sig_suppress = True + self.set(**d) + del self.sqlmeta.row_update_sig_suppress value = d[name] if from_python: dbValue = from_python(value, self._SO_validatorState) @@ -1066,7 +1070,7 @@ setattr(self, instanceName(name), value) def set(self, **kw): - if not self.sqlmeta._creating: + if not self.sqlmeta._creating and not getattr(self.sqlmeta, "row_update_sig_suppress", False): self.sqlmeta.send(events.RowUpdateSignal, self, kw) # set() is used to update multiple values at once, # potentially with one SQL statement if possible. |