- class utils.update.Updateable¶
A mixin that helps make an object easily updateable. Two Updateables are equal if all their public fields are equal.
- utils.update.all_public_fields_equal(a, b)¶
Returns: a dict of fields whose name don’t start with underscore.
- utils.update.update(*args, **kwds)¶
Update an object and then sync it with an external application.
It will deepcopy the object into whatever is named in the ‘as’ clause, run the ‘with’ code block (which presumably alters the object). Then the update() method on the original object will be called with a dict containing only changed fields, and kwargs passed to this function.
If an exception is thrown by update(), the original object will be restored, otherwise the updated object will be returned.
with update(myrecord): myrecord.lastname = 'Smith' myrecord.address.zipcode = '27707'
- utils.update.updates(old, new)¶
Return a dict of fields that are different between old and new.