server/hook.py
changeset 4845 dc351b96f596
parent 4835 13b0b96d7982
parent 4838 d4187a08ccdf
child 5019 72734c210836
--- 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