159 if not hasattr(replacement, 'eid'): |
159 if not hasattr(replacement, 'eid'): |
160 replacement = self.state_by_name(replacement) |
160 replacement = self.state_by_name(replacement) |
161 execute = self._cw.unsafe_execute |
161 execute = self._cw.unsafe_execute |
162 execute('SET X in_state S WHERE S eid %(s)s', {'s': todelstate.eid}, 's') |
162 execute('SET X in_state S WHERE S eid %(s)s', {'s': todelstate.eid}, 's') |
163 execute('SET X from_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s', |
163 execute('SET X from_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s', |
164 {'os': todelstate.eid, 'ns': newstate.eid}, 's') |
164 {'os': todelstate.eid, 'ns': replacement.eid}, 's') |
165 execute('SET X to_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s', |
165 execute('SET X to_state NS WHERE X to_state OS, OS eid %(os)s, NS eid %(ns)s', |
166 {'os': todelstate.eid, 'ns': newstate.eid}, 's') |
166 {'os': todelstate.eid, 'ns': replacement.eid}, 's') |
167 todelstate.delete() |
167 todelstate.delete() |
168 |
168 |
169 |
169 |
170 class BaseTransition(AnyEntity): |
170 class BaseTransition(AnyEntity): |
171 """customized class for abstract transition |
171 """customized class for abstract transition |
217 """return (path, parameters) which should be used as redirect |
217 """return (path, parameters) which should be used as redirect |
218 information when this entity is being deleted |
218 information when this entity is being deleted |
219 """ |
219 """ |
220 if self.transition_of: |
220 if self.transition_of: |
221 return self.transition_of[0].rest_path(), {} |
221 return self.transition_of[0].rest_path(), {} |
222 return super(Transition, self).after_deletion_path() |
222 return super(BaseTransition, self).after_deletion_path() |
223 |
223 |
224 def set_permissions(self, requiredgroups=(), conditions=(), reset=True): |
224 def set_permissions(self, requiredgroups=(), conditions=(), reset=True): |
225 """set or add (if `reset` is False) groups and conditions for this |
225 """set or add (if `reset` is False) groups and conditions for this |
226 transition |
226 transition |
227 """ |
227 """ |
328 for ep in self.subworkflow_exit: |
328 for ep in self.subworkflow_exit: |
329 result[ep.subwf_state.eid] = ep.destination and ep.destination.eid |
329 result[ep.subwf_state.eid] = ep.destination and ep.destination.eid |
330 return result |
330 return result |
331 |
331 |
332 def clear_all_caches(self): |
332 def clear_all_caches(self): |
333 super(WorkflowableMixIn, self).clear_all_caches() |
333 super(WorkflowTransition, self).clear_all_caches() |
334 clear_cache(self, 'exit_points') |
334 clear_cache(self, 'exit_points') |
335 |
335 |
336 |
336 |
337 class SubWorkflowExitPoint(AnyEntity): |
337 class SubWorkflowExitPoint(AnyEntity): |
338 """customized class for SubWorkflowExitPoint entities""" |
338 """customized class for SubWorkflowExitPoint entities""" |