consider fields_kwargs even when field specified tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 13 May 2009 13:57:51 +0200
branchtls-sprint
changeset 1782 aa7136519c19
parent 1781 7a934055dd45
child 1783 b81f9761907c
consider fields_kwargs even when field specified
web/views/autoform.py
--- a/web/views/autoform.py	Wed May 13 12:15:03 2009 +0200
+++ b/web/views/autoform.py	Wed May 13 13:57:51 2009 +0200
@@ -137,14 +137,12 @@
             # XXX use a sample target type. Document this.
             tschemas = rschema.targets(eschema, role)
             fieldcls = cls_or_self.rfields.etype_get(eschema, rschema, role, tschemas[0])
+            kwargs = cls_or_self.rfields_kwargs.etype_get(eschema, rschema, role, tschemas[0])
+            if kwargs is None:
+                kwargs = {}
             if fieldcls:
-                return fieldcls(name=name, role=role, eidparam=True)
-            kwargs = cls_or_self.rfields_kwargs.etype_get(eschema, rschema, role, tschemas[0])
-            if kwargs:
-                field = guess_field(eschema, rschema, role,
-                                    eidparam=True, **kwargs)
-            else:
-                field = guess_field(eschema, rschema, role, eidparam=True)
+                return fieldcls(name=name, role=role, eidparam=True, **kwargs)
+            field = guess_field(eschema, rschema, role, eidparam=True, **kwargs)
             if field is None:
                 raise
             return field