On Dec 16, 2007, at 2:33 PM, [EMAIL PROTECTED] wrote:
> > [EMAIL PROTECTED] wrote: >> i used to get the original (before change) value of some attribute >> via >> state.commited_state[key]... but seems now that dict is empty at >> the time >> when ext.after_* are called. >> any way to get that? storing copies at ext.before_* is not good >> alternative... > > found some workaround but not sure if it's proper thing: > r = getattr( instance.__class__, attribute).get_history( instance) > r = r[-1] or r[-2] > return r and r[0] or None #should never be None ??? > > not sure what the three get_history sublists are for... (added, unchanged, deleted) = attributes.get_history(myinstance._state, 'someattribute') three lists will never be None unless you call get_history() with passive=True and lazyload would be needed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---