server/hooks.py
branchstable
changeset 2909 e695b7b0359d
parent 2908 1c42a9826dd4
child 2920 64322aa83a1d
child 3056 61f71ed15cfa
equal deleted inserted replaced
2908:1c42a9826dd4 2909:e695b7b0359d
   428             entity = session.entity_from_eid(fromeid)
   428             entity = session.entity_from_eid(fromeid)
   429             # we should find at least one transition going to this state
   429             # we should find at least one transition going to this state
   430             try:
   430             try:
   431                 iter(state.transitions(entity, toeid)).next()
   431                 iter(state.transitions(entity, toeid)).next()
   432             except StopIteration:
   432             except StopIteration:
   433                 msg = session._('transition is not allowed')
   433                 _ = session._
       
   434                 msg = _('transition from %s to %s does not exist or is not allowed') % (
       
   435                     _(state.name), _(session.entity_from_eid(toeid).name))
   434                 raise ValidationError(fromeid, {'in_state': msg})
   436                 raise ValidationError(fromeid, {'in_state': msg})
   435         else:
   437         else:
   436             # not a transition
   438             # not a transition
   437             # check state is initial state if the workflow defines one
   439             # check state is initial state if the workflow defines one
   438             isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',
   440             isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',