Jim Steil wrote:
Oleg Broytmann wrote:
On Mon, May 12, 2008 at 12:58:37PM -0500, Jim Steil wrote:
Is there an easy way to log CRUD changes to a table? I know that I could do it by overriding all of the update methods

   Or setup listeners for signals. SQLObject send signals almost on every
action, and even allow the listeners to setup callbacks to be called after
the action. See http://sqlobject.org/SQLObject.html#events-signals

Oleg.
Thanks Oleg, I saw that too, but was confused by it. I took a look at the code and I think I understand it now.

Thanks

    -Jim
------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Ok, I've gotten my events to work, but now have another newb question that I can't seem to find the answer to. In the update listener I get the kwargs sent in to find which columns have been changed. I can reference them as a dictionary. I want to compare the fields sent in to see if they've changed and to get the previous value of them, but cannot find how to reference the specific column using a variable. What I'd like to do is the following:

def updateListener(currentValues, newValues):
   for columnName in newValues:
      newValue = newValues[columnName]
currentValue = currentValues[columnName] ----- This is what doesn't work
      #  log changes here

The currentValues[columnName] doesn't work. How can I get the old value of the changed column?

I'm guessing there is something really obvious that I'm just not grasping this morning. Obviously, I could test all values explicitly, but I'd really rather not do that, and keep this listener really generic.

   -Jim
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to