--- a/server/hook.py Tue Mar 09 10:49:57 2010 +0100
+++ b/server/hook.py Tue Mar 09 10:51:08 2010 +0100
@@ -86,16 +86,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