On Mon, 2007-07-16 at 01:25 -0700, Andy Grover wrote: > Hi Oleg and everybody, > > What is the best way to use RowUpdateSignal? I have been trying to use > it to 1) Log all updates to a hierarchy of tables to another table and > 2) update a "last_updated" row in the instance. RowUpdateSignal seems > perfect for this -- my current solution is to override __setitem__ and > set(), but using signals seems cleaner. > > So I tried to listen for RowUpdateSignal. The code comments indicates > the args dict can be changed (nice) but it led to duplicate rows being > added to the logger table -- RowUpdateSignal is called twice, once > initially, and then _SO_setvalue() calls .set() if the dict has been > added to (and this is happening because I'm adding 'last_updated' to it, > doh!) > > Is there a way to make this work? 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) > or only call .set() for added items in the dict? > > Thanks -- Andy
Have you seen sqlobject.versioning? It does half of this for you. ------------------------------------------------------------------------- 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