--- a/entities/test/unittest_wfobjs.py Thu Nov 19 18:02:04 2009 +0100
+++ b/entities/test/unittest_wfobjs.py Thu Nov 19 18:02:19 2009 +0100
@@ -495,12 +495,21 @@
# self.commit()
# test that the workflow is correctly enforced
+
+ def _cleanup_msg(self, msg):
+ """remove the variable part of one specific error message"""
+ lmsg = msg.split()
+ lmsg.pop(1)
+ lmsg.pop()
+ return ' '.join(lmsg)
+
def test_transition_checking1(self):
cnx = self.login('stduser')
user = cnx.user(self.current_session())
ex = self.assertRaises(ValidationError,
user.fire_transition, 'activate')
- self.assertEquals(ex.errors, {'by_transition': u"transition isn't allowed"})
+ self.assertEquals(self._cleanup_msg(ex.errors['by_transition']),
+ u"transition isn't allowed from")
cnx.close()
def test_transition_checking2(self):
@@ -509,7 +518,8 @@
assert user.state == 'activated'
ex = self.assertRaises(ValidationError,
user.fire_transition, 'dummy')
- self.assertEquals(ex.errors, {'by_transition': u"transition isn't allowed"})
+ self.assertEquals(self._cleanup_msg(ex.errors['by_transition']),
+ u"transition isn't allowed from")
cnx.close()
def test_transition_checking3(self):
@@ -521,7 +531,8 @@
session.set_pool()
ex = self.assertRaises(ValidationError,
user.fire_transition, 'deactivate')
- self.assertEquals(ex.errors, {'by_transition': u"transition isn't allowed"})
+ self.assertEquals(self._cleanup_msg(ex.errors['by_transition']),
+ u"transition isn't allowed from")
# get back now
user.fire_transition('activate')
cnx.commit()
--- a/web/views/editforms.py Thu Nov 19 18:02:04 2009 +0100
+++ b/web/views/editforms.py Thu Nov 19 18:02:19 2009 +0100
@@ -436,6 +436,7 @@
form = self.vreg['forms'].select('edition', self.req,
rset=self.rset, row=row,
attrcategories=('primary',),
+ copy_nav_params=False,
mainform=False)
# XXX rely on the EntityCompositeFormRenderer to put the eid input
form.remove_field(form.field_by_name('eid'))
@@ -452,7 +453,8 @@
should be the eid
"""
#self.form_title(entity)
- form = self.vreg['forms'].select(self.id, self.req, rset=self.rset)
+ form = self.vreg['forms'].select(self.id, self.req, rset=self.rset,
+ copy_nav_params=True)
self.w(form.form_render())
--- a/web/views/forms.py Thu Nov 19 18:02:04 2009 +0100
+++ b/web/views/forms.py Thu Nov 19 18:02:19 2009 +0100
@@ -89,6 +89,7 @@
if mainform:
self.form_add_hidden('__errorurl', self.session_key())
self.form_add_hidden('__domid', self.domid)
+ # XXX why do we need two different variables (mainform and copy_nav_params ?)
if self.copy_nav_params:
for param in NAV_FORM_PARAMETERS:
if not param in kwargs: