equal
deleted
inserted
replaced
32 entity type |
32 entity type |
33 """ |
33 """ |
34 return any(et for et in self.reverse_default_workflow |
34 return any(et for et in self.reverse_default_workflow |
35 if et.name == etype) |
35 if et.name == etype) |
36 |
36 |
|
37 # XXX define parent() instead? what if workflow of multiple types? |
37 def after_deletion_path(self): |
38 def after_deletion_path(self): |
38 """return (path, parameters) which should be used as redirect |
39 """return (path, parameters) which should be used as redirect |
39 information when this entity is being deleted |
40 information when this entity is being deleted |
40 """ |
41 """ |
41 if self.workflow_of: |
42 if self.workflow_of: |
242 id = 'Transition' |
243 id = 'Transition' |
243 |
244 |
244 def destination(self): |
245 def destination(self): |
245 return self.destination_state[0] |
246 return self.destination_state[0] |
246 |
247 |
|
248 def parent(self): |
|
249 return self.workflow |
|
250 |
247 |
251 |
248 class WorkflowTransition(BaseTransition): |
252 class WorkflowTransition(BaseTransition): |
249 """customized class for WorkflowTransition entities""" |
253 """customized class for WorkflowTransition entities""" |
250 id = 'WorkflowTransition' |
254 id = 'WorkflowTransition' |
251 |
255 |
307 |
311 |
308 @property |
312 @property |
309 def destination(self): |
313 def destination(self): |
310 return self.destination_state and self.destination_state[0] or None |
314 return self.destination_state and self.destination_state[0] or None |
311 |
315 |
|
316 def parent(self): |
|
317 return self.reverse_subworkflow_exit[0] |
|
318 |
312 |
319 |
313 class State(AnyEntity): |
320 class State(AnyEntity): |
314 """customized class for State entities""" |
321 """customized class for State entities""" |
315 id = 'State' |
322 id = 'State' |
316 fetch_attrs, fetch_order = fetch_config(['name']) |
323 fetch_attrs, fetch_order = fetch_config(['name']) |
319 @property |
326 @property |
320 def workflow(self): |
327 def workflow(self): |
321 # take care, may be missing in multi-sources configuration |
328 # take care, may be missing in multi-sources configuration |
322 return self.state_of and self.state_of[0] |
329 return self.state_of and self.state_of[0] |
323 |
330 |
324 def after_deletion_path(self): |
331 def parent(self): |
325 """return (path, parameters) which should be used as redirect |
332 return self.workflow |
326 information when this entity is being deleted |
|
327 """ |
|
328 if self.state_of: |
|
329 return self.state_of[0].rest_path(), {} |
|
330 return super(State, self).after_deletion_path() |
|
331 |
333 |
332 |
334 |
333 class TrInfo(AnyEntity): |
335 class TrInfo(AnyEntity): |
334 """customized class for Transition information entities |
336 """customized class for Transition information entities |
335 """ |
337 """ |
350 |
352 |
351 @property |
353 @property |
352 def transition(self): |
354 def transition(self): |
353 return self.by_transition and self.by_transition[0] or None |
355 return self.by_transition and self.by_transition[0] or None |
354 |
356 |
355 def after_deletion_path(self): |
357 def parent(self): |
356 """return (path, parameters) which should be used as redirect |
358 return self.for_entity |
357 information when this entity is being deleted |
|
358 """ |
|
359 if self.for_entity: |
|
360 return self.for_entity.rest_path(), {} |
|
361 return 'view', {} |
|
362 |
359 |
363 |
360 |
364 class WorkflowableMixIn(object): |
361 class WorkflowableMixIn(object): |
365 """base mixin providing workflow helper methods for workflowable entities. |
362 """base mixin providing workflow helper methods for workflowable entities. |
366 This mixin will be automatically set on class supporting the 'in_state' |
363 This mixin will be automatically set on class supporting the 'in_state' |