--- a/entity.py Tue May 12 18:16:11 2009 +0200
+++ b/entity.py Tue May 12 19:20:23 2009 +0200
@@ -130,8 +130,8 @@
wdgname = 'TextInput'
widget = getattr(formwidgets, wdgname)
assert hasattr(widget, 'render')
- uicfg.autoform_widget.tag_subject_of((etype, rtype, '*'),
- widget)
+ uicfg.autoform_field_kwargs.tag_subject_of(
+ (etype, rtype, '*'), {'widget': widget})
return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
--- a/web/uicfg.py Tue May 12 18:16:11 2009 +0200
+++ b/web/uicfg.py Tue May 12 19:20:23 2009 +0200
@@ -217,11 +217,12 @@
# relations'field class
autoform_field = RelationTags()
-# relations'widget class
-autoform_widget = RelationTags()
-autoform_widget.tag_attribute(('RQLExpression', 'expression'),
- formwidgets.TextInput)
-autoform_widget.tag_attribute(('Bookmark', 'path'), formwidgets.TextInput)
+# relations'field explicit kwargs (given to field's __init__)
+autoform_field_kwargs = RelationTags()
+autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
+ {'widget': formwidgets.TextInput})
+autoform_field_kwargs.tag_attribute(('Bookmark', 'path'),
+ {'widget': formwidgets.TextInput})
--- a/web/views/autoform.py Tue May 12 18:16:11 2009 +0200
+++ b/web/views/autoform.py Tue May 12 19:20:23 2009 +0200
@@ -40,7 +40,7 @@
# don't want them to be reloaded
rcategories = uicfg.autoform_section
rfields = uicfg.autoform_field
- rwidgets = uicfg.autoform_widget
+ rfields_kwargs = uicfg.autoform_field_kwargs
rinlined = uicfg.autoform_is_inlined
rpermissions_overrides = uicfg.autoform_permissions_overrides
@@ -139,10 +139,10 @@
fieldcls = cls_or_self.rfields.etype_get(eschema, rschema, role, tschemas[0])
if fieldcls:
return fieldcls(name=name, role=role, eidparam=True)
- widget = cls_or_self.rwidgets.etype_get(eschema, rschema, role, tschemas[0])
- if widget:
+ kwargs = cls_or_self.rfields_kwargs.etype_get(eschema, rschema, role, tschemas[0])
+ if kwargs:
field = guess_field(eschema, rschema, role,
- eidparam=True, widget=widget)
+ eidparam=True, **kwargs)
else:
field = guess_field(eschema, rschema, role, eidparam=True)
if field is None: