[config, undo] Fix undo-support option migration
authorAnthony Truchet <anthony.truchet@logilab.fr>
Thu, 15 Mar 2012 14:26:12 +0100
changeset 8306 4da49700b06a
parent 8299 e5d636081571
child 8307 8be58694f416
[config, undo] Fix undo-support option migration
devtools/__init__.py
hooks/__init__.py
misc/migration/3.15.0_common.py
server/serverconfig.py
server/session.py
web/views/actions.py
--- a/devtools/__init__.py	Tue Mar 13 14:11:40 2012 +0100
+++ b/devtools/__init__.py	Thu Mar 15 14:26:12 2012 +0100
@@ -168,7 +168,7 @@
     def load_configuration(self):
         super(TestServerConfiguration, self).load_configuration()
         # no undo support in tests
-        self.global_set_option('undo-support', 'n')
+        self.global_set_option('undo-enabled', 'n')
 
     def main_config_file(self):
         """return instance's control configuration file"""
--- a/hooks/__init__.py	Tue Mar 13 14:11:40 2012 +0100
+++ b/hooks/__init__.py	Thu Mar 15 14:26:12 2012 +0100
@@ -46,7 +46,7 @@
                 session.commit()
             finally:
                 session.close()
-        if self.repo.config['undo-support']:
+        if self.repo.config['undo-enabled']:
             self.repo.looping_task(60*60*24, cleanup_old_transactions,
                                    self.repo)
         def update_feeds(repo):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.15.0_common.py	Thu Mar 15 14:26:12 2012 +0100
@@ -0,0 +1,2 @@
+undo_actions = config.cfgfile_parser.get('MAIN', 'undo-support', False)
+config.global_set_option('undo-enabled', bool(undo_actions))
--- a/server/serverconfig.py	Tue Mar 13 14:11:40 2012 +0100
+++ b/server/serverconfig.py	Thu Mar 15 14:26:12 2012 +0100
@@ -140,7 +140,7 @@
           'help': 'size of the parsed rql cache size.',
           'group': 'main', 'level': 3,
           }),
-        ('undo-support',
+        ('undo-enabled',
          {'type' : 'yn', 'default': False,
           'help': 'enable undo support',
           'group': 'main', 'level': 3,
--- a/server/session.py	Tue Mar 13 14:11:40 2012 +0100
+++ b/server/session.py	Thu Mar 15 14:26:12 2012 +0100
@@ -256,7 +256,7 @@
         if repo.config.creating or repo.config.repairing or self.is_internal_session:
             self.undo_actions = False
         else:
-            self.undo_actions = repo.config['undo-support']
+            self.undo_actions = repo.config['undo-enabled']
         # short cut to querier .execute method
         self._execute = repo.querier.execute
         # shared data, used to communicate extra information between the client
@@ -888,7 +888,7 @@
         """return a tuple (type, sourceuri, extid) for the entity with id <eid>"""
         metas = self.repo.type_and_source_from_eid(eid, self)
         if asdict:
-            return dict(zip(('type', 'source', 'extid', 'asource'), metas)) 
+            return dict(zip(('type', 'source', 'extid', 'asource'), metas))
        # XXX :-1 for cw compat, use asdict=True for full information
         return metas[:-1]
 
--- a/web/views/actions.py	Tue Mar 13 14:11:40 2012 +0100
+++ b/web/views/actions.py	Thu Mar 15 14:26:12 2012 +0100
@@ -86,7 +86,7 @@
     "Select entities having public (i.e. end-user) undoable transactions."
 
     def score_entity(self, entity):
-        if not entity._cw.vreg.config['undo-support']:
+        if not entity._cw.vreg.config['undo-enabled']:
             return 0
         if entity._cw.cnx.undoable_transactions(eid=entity.eid):
             return 1