[notification] don't create 'changes' in transaction data until actually needed stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 24 Mar 2010 14:12:47 +0100
branchstable
changeset 4993 c9229f185690
parent 4992 398cc8b39aec
child 4994 108bb7f2a171
[notification] don't create 'changes' in transaction data until actually needed
hooks/notification.py
--- a/hooks/notification.py	Wed Mar 24 14:11:01 2010 +0100
+++ b/hooks/notification.py	Wed Mar 24 14:12:47 2010 +0100
@@ -112,12 +112,12 @@
         if session.added_in_transaction(self.entity.eid):
             return # entity is being created
         # then compute changes
-        changes = session.transaction_data.setdefault('changes', {})
-        thisentitychanges = changes.setdefault(self.entity.eid, set())
         attrs = [k for k in self.entity.edited_attributes
                  if not k in self.skip_attrs]
         if not attrs:
             return
+        changes = session.transaction_data.setdefault('changes', {})
+        thisentitychanges = changes.setdefault(self.entity.eid, set())
         rqlsel, rqlrestr = [], ['X eid %(x)s']
         for i, attr in enumerate(attrs):
             var = chr(65+i)