equal
deleted
inserted
replaced
14 |
14 |
15 from cubicweb.entities import AnyEntity, fetch_config |
15 from cubicweb.entities import AnyEntity, fetch_config |
16 from cubicweb.interfaces import IWorkflowable |
16 from cubicweb.interfaces import IWorkflowable |
17 from cubicweb.common.mixins import MI_REL_TRIGGERS |
17 from cubicweb.common.mixins import MI_REL_TRIGGERS |
18 |
18 |
|
19 class WorkflowException(Exception): pass |
19 |
20 |
20 class Workflow(AnyEntity): |
21 class Workflow(AnyEntity): |
21 id = 'Workflow' |
22 id = 'Workflow' |
22 |
23 |
23 @property |
24 @property |
158 id = 'BaseTransition' |
159 id = 'BaseTransition' |
159 fetch_attrs, fetch_order = fetch_config(['name']) |
160 fetch_attrs, fetch_order = fetch_config(['name']) |
160 |
161 |
161 def __init__(self, *args, **kwargs): |
162 def __init__(self, *args, **kwargs): |
162 if self.id == 'BaseTransition': |
163 if self.id == 'BaseTransition': |
163 raise Exception('should not be instantiated') |
164 raise WorkflowException('should not be instantiated') |
164 super(BaseTransition, self).__init__(*args, **kwargs) |
165 super(BaseTransition, self).__init__(*args, **kwargs) |
165 |
166 |
166 @property |
167 @property |
167 def workflow(self): |
168 def workflow(self): |
168 return self.transition_of[0] |
169 return self.transition_of[0] |