hooks/metadata.py
branchstable
changeset 4578 060c91ced72f
parent 4307 7fba9c34c88f
child 4806 4f12f59b1a13
equal deleted inserted replaced
4577:049d92fc8614 4578:060c91ced72f
    53     """update an entity -> set modification date"""
    53     """update an entity -> set modification date"""
    54     __regid__ = 'metaattrsupdate'
    54     __regid__ = 'metaattrsupdate'
    55     events = ('before_update_entity',)
    55     events = ('before_update_entity',)
    56 
    56 
    57     def __call__(self):
    57     def __call__(self):
    58         self.entity.setdefault('modification_date', datetime.now())
    58         # repairing is true during c-c upgrade/shell and similar commands. We
       
    59         # usually don't want to update modification date in such cases.
       
    60         #
       
    61         # XXX to be really clean, we should turn off modification_date update
       
    62         # explicitly on each command where we do not want that behaviour.
       
    63         if not self._cw.vreg.config.repairing:
       
    64             self.entity.setdefault('modification_date', datetime.now())
    59 
    65 
    60 
    66 
    61 class _SetCreatorOp(hook.Operation):
    67 class _SetCreatorOp(hook.Operation):
    62 
    68 
    63     def precommit_event(self):
    69     def precommit_event(self):