Oleg Broytmann wrote:
> On Mon, Jul 16, 2007 at 01:25:00AM -0700, Andy Grover wrote:
>> Could the call to .set() in
>> _SO_setvalue perhaps suppress the second RowUpdateSignal (since any
>> added values must have been added in the first call to RowUpdateSignal)
> 
>    Any patch?

Well maybe David is right and I should be using Versioning, but here is
a patch. :)

-- Andy
Index: sqlobject/main.py
===================================================================
--- sqlobject/main.py	(revision 2757)
+++ sqlobject/main.py	(working copy)
@@ -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._sig_suppress = True
+            self.set(**d)
+            del self.sqlmeta._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 self.sqlmeta._sig_suppress:
             self.sqlmeta.send(events.RowUpdateSignal, self, kw)
         # set() is used to update multiple values at once,
         # potentially with one SQL statement if possible.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to