Oleg Broytmann wrote:
On Tue, May 13, 2008 at 10:48:24AM -0500, Jim Steil wrote:
  
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.
  
Thanks Oleg, that is exactly what I needed.

    -Jim