[form] put unknown constructor args into extra_kwargs and consider them when looking for field display values stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 29 Sep 2009 12:43:40 +0200
branchstable
changeset 3516 5f18e71e3d42
parent 3515 3edebe9414fa
child 3517 8832e231fad7
[form] put unknown constructor args into extra_kwargs and consider them when looking for field display values
web/views/forms.py
--- a/web/views/forms.py	Tue Sep 29 12:42:24 2009 +0200
+++ b/web/views/forms.py	Tue Sep 29 12:43:40 2009 +0200
@@ -82,6 +82,8 @@
                 self.form_add_hidden(key, val)
             elif hasattr(self.__class__, key) and not key[0] == '_':
                 setattr(self, key, val)
+            else:
+                self.extra_kwargs[key] = val
             # skip other parameters, usually given for selection
             # (else write a custom class to handle them)
         if mainform:
@@ -179,6 +181,8 @@
         if value is None:
             if field.name in rendervalues:
                 value = rendervalues[field.name]
+            elif field.name in self.extra_kwargs:
+                value = self.extra_kwargs[field.name]
             else:
                 value = self.form_field_value(field, load_bytes)
                 if callable(value):