[hooks] entity_oldnewvalue should never return _MARKER: if the attribute isn't in the entity dict (hence unmodified), return the old value
--- a/server/hook.py Fri Jun 11 18:48:17 2010 +0200
+++ b/server/hook.py Mon Jun 14 18:58:03 2010 +0200
@@ -122,6 +122,7 @@
_MARKER = object()
def entity_oldnewvalue(entity, attr):
"""returns the couple (old attr value, new attr value)
+
NOTE: will only work in a before_update_entity hook
"""
# get new value and remove from local dict to force a db query to
@@ -130,6 +131,8 @@
oldvalue = getattr(entity, attr)
if newvalue is not _MARKER:
entity[attr] = newvalue
+ else:
+ newvalue = oldvalue
return oldvalue, newvalue