don't update modification_date in repairing_mode (eg upgrade or shell) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 15 Feb 2010 15:14:50 +0100
branchstable
changeset 4578 060c91ced72f
parent 4577 049d92fc8614
child 4579 19d73051eb57
don't update modification_date in repairing_mode (eg upgrade or shell)
hooks/metadata.py
--- a/hooks/metadata.py	Mon Feb 15 15:14:27 2010 +0100
+++ b/hooks/metadata.py	Mon Feb 15 15:14:50 2010 +0100
@@ -55,7 +55,13 @@
     events = ('before_update_entity',)
 
     def __call__(self):
-        self.entity.setdefault('modification_date', datetime.now())
+        # repairing is true during c-c upgrade/shell and similar commands. We
+        # usually don't want to update modification date in such cases.
+        #
+        # XXX to be really clean, we should turn off modification_date update
+        # explicitly on each command where we do not want that behaviour.
+        if not self._cw.vreg.config.repairing:
+            self.entity.setdefault('modification_date', datetime.now())
 
 
 class _SetCreatorOp(hook.Operation):