equal
deleted
inserted
replaced
66 class SetCreatorOp(hook.DataOperationMixIn, hook.Operation): |
66 class SetCreatorOp(hook.DataOperationMixIn, hook.Operation): |
67 |
67 |
68 def precommit_event(self): |
68 def precommit_event(self): |
69 session = self.session |
69 session = self.session |
70 relations = [(eid, session.user.eid) for eid in self.get_data() |
70 relations = [(eid, session.user.eid) for eid in self.get_data() |
71 # don't consider entities that have been created and |
71 # don't consider entities that have been created and deleted in |
72 # deleted in the same transaction |
72 # the same transaction, nor ones where created_by has been |
|
73 # explicitly set |
73 if not session.deleted_in_transaction(eid) and \ |
74 if not session.deleted_in_transaction(eid) and \ |
74 not session.entity_from_eid(eid).created_by] |
75 not session.entity_from_eid(eid).created_by] |
75 session.add_relations([('created_by', relations)]) |
76 session.add_relations([('created_by', relations)]) |
76 |
77 |
77 |
78 |