#343290: inputs don't use value specified in URL stable
authorsylvain.thenault@logilab.fr
Mon, 18 May 2009 14:36:09 +0200
branchstable
changeset 1843 646c2dd1f03e
parent 1842 c7a22540d6f7
child 1845 bd6a434382b8
#343290: inputs don't use value specified in URL
web/form.py
web/test/unittest_form.py
--- a/web/form.py	Mon May 18 14:22:26 2009 +0200
+++ b/web/form.py	Mon May 18 14:36:09 2009 +0200
@@ -372,6 +372,8 @@
             return self.form_previous_values[qname]
         if qname in self.req.form:
             return self.req.form[qname]
+        if field.name in self.req.form:
+            return self.req.form[field.name]
         return None
 
     def form_field_value(self, field, load_bytes=False):
--- a/web/test/unittest_form.py	Mon May 18 14:22:26 2009 +0200
+++ b/web/test/unittest_form.py	Mon May 18 14:36:09 2009 +0200
@@ -64,7 +64,14 @@
         self.assertEquals(len(states), 1)
         self.assertEquals(states[0][0], u'deactivated') # list of (combobox view, state eid)
 
-
+    def test_consider_req_form_params(self):
+        e = self.etype_instance('CWUser')
+        e.eid = 'A'
+        form = EntityFieldsForm(self.request(login=u'toto'), None, entity=e)
+        field = StringField(name='login', eidparam=True)
+        form.append_field(field)
+        form.form_build_context({})
+        self.assertEquals(form.form_field_display_value(field, {}), 'toto')
 
     # form view tests #########################################################