[migration] new command to get default workflow for an entity type stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 02 May 2011 15:46:03 +0200
branchstable
changeset 7295 b6fd14ee491e
parent 7292 258c92805066
child 7296 e559ade02665
child 7297 117dbb11a42e
[migration] new command to get default workflow for an entity type * * * typo
server/migractions.py
--- a/server/migractions.py	Fri Apr 29 20:16:54 2011 +0200
+++ b/server/migractions.py	Mon May 02 15:46:03 2011 +0200
@@ -1249,6 +1249,12 @@
             self.commit()
         return wf
 
+    def cmd_get_workflow_for(self, etype):
+        """return default workflow for the given entity type"""
+        rset = self.rqlexec('Workflow X WHERE ET default_workflow X, ET name %(et)s',
+                            {'et': etype})
+        return rset.get_entity(0, 0)
+
     # XXX remove once cmd_add_[state|transition] are removed
     def _get_or_create_wf(self, etypes):
         if not isinstance(etypes, (list, tuple)):