[sqlalchemy] Re: validation and old values

2008-06-29 Thread sandro dentella

thanks

sandro
*:-)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sqlalchemy] Re: validation and old values

2008-06-25 Thread Michael Bayer


On Jun 25, 2008, at 1:45 PM, sandro dentella wrote:


 Hi,

   I'm adding validation to a (generic) gtk sql editor.

   The first thing I'd like to know is if I can reach the old values
   of an instance after I modified it (before committing).
   The reason is that I'd like  to give the possibility to have new
   and old values in the validation of the record.

   thanks in advance


the full historical data for an attribute is available as:

from sqlalchemy.orm import attributes

hist = attributes.get_history(attributes.instance_state(myobject),  
'someattribute')

the return value is a tuple of (newvalues, unchangedvalues,  
deletedvalues) and is the same form for collections and scalars.



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---