--- a/web/uicfg.py Fri Jul 10 09:44:36 2009 +0200
+++ b/web/uicfg.py Fri Jul 10 12:15:09 2009 +0200
@@ -68,7 +68,8 @@
__docformat__ = "restructuredtext en"
from cubicweb import neg_role
-from cubicweb.rtags import RelationTags, RelationTagsBool, RelationTagsSet
+from cubicweb.rtags import (RelationTags, RelationTagsBool,
+ RelationTagsSet, RelationTagsDict)
from cubicweb.web import formwidgets
@@ -118,14 +119,13 @@
primaryview_section.tag_attribute(('CWRType', attr), 'hidden')
-class DisplayCtrlRelationTags(RelationTags):
+class DisplayCtrlRelationTags(RelationTagsDict):
def __init__(self, *args, **kwargs):
super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs)
self._counter = 0
def tag_relation(self, key, tag):
- assert isinstance(tag, dict)
- super(DisplayCtrlRelationTags, self).tag_relation(key, tag)
+ tag = super(DisplayCtrlRelationTags, self).tag_relation(key, tag)
self._counter += 1
tag.setdefault('order', self._counter)
@@ -152,11 +152,8 @@
else:
sschema = '*'
label = '%s_%s' % (rschema, role)
- displayinfo = rtag.get(sschema, rschema, oschema, role)
- if displayinfo is None:
- displayinfo = {}
- rtag.tag_relation((sschema, rschema, oschema, role), displayinfo)
- displayinfo.setdefault('label', label)
+ rtag.setdefault((sschema, rschema, oschema, role), 'label', label)
+ rtag.setdefault((sschema, rschema, oschema, role), 'order', rtag._counter)
primaryview_display_ctrl = DisplayCtrlRelationTags('primaryview_display_ctrl',
init_primaryview_display_ctrl)
@@ -239,7 +236,7 @@
autoform_field = RelationTags('autoform_field')
# relations'field explicit kwargs (given to field's __init__)
-autoform_field_kwargs = RelationTags()
+autoform_field_kwargs = RelationTagsDict()
autoform_field_kwargs.tag_attribute(('RQLExpression', 'expression'),
{'widget': formwidgets.TextInput})
autoform_field_kwargs.tag_attribute(('Bookmark', 'path'),