server/migractions.py
branchstable
changeset 6816 f61de39cd396
parent 6815 a84190d4e78c
child 6918 9e607157d4cf
--- a/server/migractions.py	Thu Jan 13 12:36:08 2011 +0100
+++ b/server/migractions.py	Thu Jan 13 12:49:44 2011 +0100
@@ -1208,7 +1208,7 @@
         self.cmd_add_relation_definition('TrInfo', 'wf_info_for', etype)
 
     def cmd_add_workflow(self, name, wfof, default=True, commit=False,
-                         **kwargs):
+                         ensure_workflowable=True, **kwargs):
         """
         create a new workflow and links it to entity types
          :type name: unicode
@@ -1232,9 +1232,10 @@
             return 'missing workflow relations, see make_workflowable(%s)' % etype
         for etype in wfof:
             eschema = self.repo.schema[etype]
-            assert 'in_state' in eschema.subjrels, _missing_wf_rel(etype)
-            assert 'custom_workflow' in eschema.subjrels, _missing_wf_rel(etype)
-            assert 'wf_info_for' in eschema.objrels, _missing_wf_rel(etype)
+            if ensure_workflowable:
+                assert 'in_state' in eschema.subjrels, _missing_wf_rel(etype)
+                assert 'custom_workflow' in eschema.subjrels, _missing_wf_rel(etype)
+                assert 'wf_info_for' in eschema.objrels, _missing_wf_rel(etype)
             rset = self.rqlexec(
                 'SET X workflow_of ET WHERE X eid %(x)s, ET name %(et)s',
                 {'x': wf.eid, 'et': etype}, ask_confirm=False)