fix submit message handling in entity form
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 05 Jun 2009 10:23:56 +0200
changeset 2050 ce184fdb1e56
parent 2049 b9baedffeb8b
child 2051 e4d24e4d74e6
fix submit message handling in entity form
web/views/forms.py
--- a/web/views/forms.py	Fri Jun 05 10:18:40 2009 +0200
+++ b/web/views/forms.py	Fri Jun 05 10:23:56 2009 +0200
@@ -267,14 +267,18 @@
             self.edited_entity = self.complete_entity(self.row or 0, self.col or 0)
         self.form_add_hidden('__type', eidparam=True)
         self.form_add_hidden('eid')
-        if msg:
-            self.form_add_hidden('__message', msg)
         if kwargs.get('mainform'):
             self.form_add_hidden(u'__maineid', self.edited_entity.eid)
             # If we need to directly attach the new object to another one
-            for linkto in self.req.list_form_param('__linkto'):
-                self.form_add_hidden('__linkto', linkto)
-                msg = '%s %s' % (msg, self.req._('and linked'))
+            if self.req.list_form_param('__linkto'):
+                for linkto in self.req.list_form_param('__linkto'):
+                    self.form_add_hidden('__linkto', linkto)
+                if msg:
+                    msg = '%s %s' % (msg, self.req._('and linked'))
+                else:
+                    msg = self.req._('entity linked')
+        if msg:
+            self.form_add_hidden('__message', msg)
 
     def _field_has_error(self, field):
         """return true if the field has some error in given validation exception