[schema] make_workflowable now take an option description for the in_state relation 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 Aug 2009 14:57:36 +0200
branch3.5
changeset 2957 2daabf4c646e
parent 2956 6a57c0be0e58
child 2964 7c80f9631f8b
[schema] make_workflowable now take an option description for the in_state relation
schema.py
--- a/schema.py	Fri Aug 21 14:56:15 2009 +0200
+++ b/schema.py	Fri Aug 21 14:57:36 2009 +0200
@@ -853,7 +853,7 @@
             make_workflowable(cls)
         return cls
 
-def make_workflowable(cls):
+def make_workflowable(cls, in_state_descr=None):
     existing_rels = set(rdef.name for rdef in cls.__relations__)
     # let relation types defined in cw.schemas.workflow carrying
     # cardinality, constraints and other relation definition properties
@@ -861,7 +861,7 @@
         rdef = ybo.SubjectRelation('Workflow')
         yams_add_relation(cls.__relations__, rdef, 'custom_workflow')
     if 'in_state' not in existing_rels:
-        rdef = ybo.SubjectRelation('State')
+        rdef = ybo.SubjectRelation('State', description=in_state_descr)
         yams_add_relation(cls.__relations__, rdef, 'in_state')
     if 'wf_info_for' not in existing_rels:
         rdef = ybo.ObjectRelation('TrInfo')