--- 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)
--- a/server/test/unittest_migractions.py Thu Jan 13 12:36:08 2011 +0100
+++ b/server/test/unittest_migractions.py Thu Jan 13 12:49:44 2011 +0100
@@ -189,7 +189,8 @@
def test_workflow_actions(self):
- wf = self.mh.cmd_add_workflow(u'foo', ('Personne', 'Email'))
+ wf = self.mh.cmd_add_workflow(u'foo', ('Personne', 'Email'),
+ ensure_workflowable=False)
for etype in ('Personne', 'Email'):
s1 = self.mh.rqlexec('Any N WHERE WF workflow_of ET, ET name "%s", WF name N' %
etype)[0][0]
@@ -225,7 +226,8 @@
def test_add_drop_entity_type(self):
self.mh.cmd_add_entity_type('Folder2')
- wf = self.mh.cmd_add_workflow(u'folder2 wf', 'Folder2')
+ wf = self.mh.cmd_add_workflow(u'folder2 wf', 'Folder2',
+ ensure_workflowable=False)
todo = wf.add_state(u'todo', initial=True)
done = wf.add_state(u'done')
wf.add_transition(u'redoit', done, todo)