--- a/server/hook.py Tue Mar 09 11:01:44 2010 +0100
+++ b/server/hook.py Tue Mar 09 11:05:29 2010 +0100
@@ -95,16 +95,16 @@
VRegistry.REGISTRY_FACTORY['hooks'] = HooksRegistry
-
+_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
# fetch old value
- newvalue = entity.pop(attr, None)
+ newvalue = entity.pop(attr, _MARKER)
oldvalue = getattr(entity, attr)
- if newvalue is not None:
+ if newvalue is not _MARKER:
entity[attr] = newvalue
return oldvalue, newvalue