sobjects/textparsers.py
branchstable
changeset 5994 97c55baefa0c
parent 5556 9ab2b4c74baf
child 6911 75849076fd6c
equal deleted inserted replaced
5976:00b1b6b906cf 5994:97c55baefa0c
    72                 self.error("can't get entity with eid %s", eid)
    72                 self.error("can't get entity with eid %s", eid)
    73                 continue
    73                 continue
    74             if not hasattr(entity, 'in_state'):
    74             if not hasattr(entity, 'in_state'):
    75                 self.error('bad change state instruction for eid %s', eid)
    75                 self.error('bad change state instruction for eid %s', eid)
    76                 continue
    76                 continue
    77             tr = entity.current_workflow and entity.current_workflow.transition_by_name(trname)
    77             iworkflowable = entity.cw_adapt_to('IWorkflowable')
       
    78             if iworkflowable.current_workflow:
       
    79                 tr = iworkflowable.current_workflow.transition_by_name(trname)
       
    80             else:
       
    81                 tr = None
    78             if tr and tr.may_be_fired(entity.eid):
    82             if tr and tr.may_be_fired(entity.eid):
    79                 try:
    83                 try:
    80                     trinfo = entity.fire_transition(tr)
    84                     trinfo = iworkflowable.fire_transition(tr)
    81                     caller.fire_event('state-changed', {'trinfo': trinfo,
    85                     caller.fire_event('state-changed', {'trinfo': trinfo,
    82                                                         'entity': entity})
    86                                                         'entity': entity})
    83                 except:
    87                 except:
    84                     self.exception('while changing state of %s', entity)
    88                     self.exception('while changing state of %s', entity)
    85             else:
    89             else: