[hooks] say which are the states stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 18 Aug 2009 15:50:46 +0200
branchstable
changeset 2908 1c42a9826dd4
parent 2904 b9d3f7f884ce
child 2909 e695b7b0359d
[hooks] say which are the states
entities/wfobjs.py
server/hooks.py
--- a/entities/wfobjs.py	Tue Aug 18 14:27:27 2009 +0200
+++ b/entities/wfobjs.py	Tue Aug 18 15:50:46 2009 +0200
@@ -66,6 +66,7 @@
     rest_attr = 'eid'
 
     def transitions(self, entity, desteid=None):
+        """generates transition that MAY be passed"""
         rql = ('Any T,N,DS where S allowed_transition T, S eid %(x)s, '
                'T name N, T destination_state DS, '
                'T transition_of ET, ET name %(et)s')
--- a/server/hooks.py	Tue Aug 18 14:27:27 2009 +0200
+++ b/server/hooks.py	Tue Aug 18 15:50:46 2009 +0200
@@ -438,7 +438,9 @@
             isrset = session.unsafe_execute('Any S WHERE ET initial_state S, ET name %(etype)s',
                                             {'etype': etype})
             if isrset and not toeid == isrset[0][0]:
-                msg = session._('not the initial state for this entity')
+                _ = session._
+                msg = _('%s is not the initial state (%s) for this entity') % (
+                    _(session.entity_from_eid(toeid).name), _(isrset.get_entity(0,0).name))
                 raise ValidationError(fromeid, {'in_state': msg})
     eschema = session.repo.schema[etype]
     if not 'wf_info_for' in eschema.object_relations():