I have a situation where an object in the ORM performs some calculations
and other assorted checks. One of these situations is checking to see the
difference between the original value of an attribute and the current value
-- in particular, some of the validation going on should prohibit a change
that causes a particular check to fail, but only if that check wasn't
already failing (e.g. some legacy)
I see that I can use inspect() to get the history of attributes, but that
quickly gets unwieldy when working with a large number of attributes. What
I'd love to be able to do is something like:
def do_something(self):
orig = get_original_version(self)
delta = self.value - orig.value
# ....
Is there a simple way to accomplish this? Right now I'm doing something
like:
orig_value, = inspect(self).attrs.value.history.non_added or
(default_value, )
which seems messy and only works for scalar values.
-- Daniel
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.