equal
deleted
inserted
replaced
39 """ |
39 """ |
40 __regid__ = 'metaattrsinit' |
40 __regid__ = 'metaattrsinit' |
41 events = ('before_add_entity',) |
41 events = ('before_add_entity',) |
42 |
42 |
43 def __call__(self): |
43 def __call__(self): |
44 timestamp = datetime.now() |
44 timestamp = datetime.utcnow() |
45 edited = self.entity.cw_edited |
45 edited = self.entity.cw_edited |
46 if not edited.get('creation_date'): |
46 if not edited.get('creation_date'): |
47 edited['creation_date'] = timestamp |
47 edited['creation_date'] = timestamp |
48 if not edited.get('modification_date'): |
48 if not edited.get('modification_date'): |
49 edited['modification_date'] = timestamp |
49 edited['modification_date'] = timestamp |
62 # usually don't want to update modification date in such cases. |
62 # usually don't want to update modification date in such cases. |
63 # |
63 # |
64 # XXX to be really clean, we should turn off modification_date update |
64 # XXX to be really clean, we should turn off modification_date update |
65 # explicitly on each command where we do not want that behaviour. |
65 # explicitly on each command where we do not want that behaviour. |
66 if not self._cw.vreg.config.repairing: |
66 if not self._cw.vreg.config.repairing: |
67 self.entity.cw_edited.setdefault('modification_date', datetime.now()) |
67 self.entity.cw_edited.setdefault('modification_date', datetime.utcnow()) |
68 |
68 |
69 |
69 |
70 class SetCreatorOp(hook.DataOperationMixIn, hook.Operation): |
70 class SetCreatorOp(hook.DataOperationMixIn, hook.Operation): |
71 |
71 |
72 def precommit_event(self): |
72 def precommit_event(self): |