14 May 17:36
Re: Log changes to rows
From: Jim Steil <jim <at> qlf.com>
Subject: Re: Log changes to rows
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-05-14 15:37:31 GMT
Subject: Re: Log changes to rows
Newsgroups: gmane.comp.python.sqlobject
Date: 2008-05-14 15:37:31 GMT
Oleg Broytmann wrote:
-Jim
On Tue, May 13, 2008 at 10:48:24AM -0500, Jim Steil wrote:Is there a way in the RowCreatedSignal event to capture the name of the object (table) that is being inserted into?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 believe 'currentValues' is the object (SQLObject) to be changed, not a dictionary. Get the values by calling getattr(currentValues, columnName). Oleg.
-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 <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
RSS Feed