equal
deleted
inserted
replaced
85 return None |
85 return None |
86 |
86 |
87 def transition_by_name(self, trname): |
87 def transition_by_name(self, trname): |
88 rset = self._cw.execute('Any T, TN WHERE T name TN, T name %(n)s, ' |
88 rset = self._cw.execute('Any T, TN WHERE T name TN, T name %(n)s, ' |
89 'T transition_of WF, WF eid %(wf)s', |
89 'T transition_of WF, WF eid %(wf)s', |
90 {'n': trname, 'wf': self.eid}) |
90 {'n': unicode(trname), 'wf': self.eid}) |
91 if rset: |
91 if rset: |
92 return rset.get_entity(0, 0) |
92 return rset.get_entity(0, 0) |
93 return None |
93 return None |
94 |
94 |
95 def transition_by_eid(self, eid): |
95 def transition_by_eid(self, eid): |
229 self._cw.execute('DELETE T condition R WHERE T eid %(x)s', |
229 self._cw.execute('DELETE T condition R WHERE T eid %(x)s', |
230 {'x': self.eid}) |
230 {'x': self.eid}) |
231 for gname in requiredgroups: |
231 for gname in requiredgroups: |
232 rset = self._cw.execute('SET T require_group G ' |
232 rset = self._cw.execute('SET T require_group G ' |
233 'WHERE T eid %(x)s, G name %(gn)s', |
233 'WHERE T eid %(x)s, G name %(gn)s', |
234 {'x': self.eid, 'gn': gname}) |
234 {'x': self.eid, 'gn': unicode(gname)}) |
235 assert rset, '%s is not a known group' % gname |
235 assert rset, '%s is not a known group' % gname |
236 if isinstance(conditions, basestring): |
236 if isinstance(conditions, basestring): |
237 conditions = (conditions,) |
237 conditions = (conditions,) |
238 for expr in conditions: |
238 for expr in conditions: |
239 if isinstance(expr, basestring): |
239 if isinstance(expr, basestring): |
452 return |
452 return |
453 rset = self._cw.execute( |
453 rset = self._cw.execute( |
454 'Any T,TT, TN WHERE S allowed_transition T, S eid %(x)s, ' |
454 'Any T,TT, TN WHERE S allowed_transition T, S eid %(x)s, ' |
455 'T type TT, T type %(type)s, ' |
455 'T type TT, T type %(type)s, ' |
456 'T name TN, T transition_of WF, WF eid %(wfeid)s', |
456 'T name TN, T transition_of WF, WF eid %(wfeid)s', |
457 {'x': self.current_state.eid, 'type': type, |
457 {'x': self.current_state.eid, 'type': unicode(type), |
458 'wfeid': self.current_workflow.eid}) |
458 'wfeid': self.current_workflow.eid}) |
459 for tr in rset.entities(): |
459 for tr in rset.entities(): |
460 if tr.may_be_fired(self.entity.eid): |
460 if tr.may_be_fired(self.entity.eid): |
461 yield tr |
461 yield tr |
462 |
462 |