49 from cubicweb.web.views.editforms import AutomaticEntityForm |
49 from cubicweb.web.views.editforms import AutomaticEntityForm |
50 |
50 |
51 def _dispatch_rtags(tags, rtype, role, stype, otype): |
51 def _dispatch_rtags(tags, rtype, role, stype, otype): |
52 for tag in tags: |
52 for tag in tags: |
53 if tag in _MODE_TAGS: |
53 if tag in _MODE_TAGS: |
54 uicfg.rmode.set_rtag(tag, rtype, role, stype, otype) |
54 uicfg.rmode.tag_relation(tag, (stype, rtype, otype), role) |
55 elif tag in _CATEGORY_TAGS: |
55 elif tag in _CATEGORY_TAGS: |
56 uicfg.rcategories.set_rtag(tag, rtype, role, stype, otype) |
56 uicfg.rcategories.tag_relation(tag, (stype, rtype, otype), role) |
57 elif tag == 'inlineview': |
57 elif tag == 'inlineview': |
58 uicfg.rinlined.set_rtag(True, rtype, role, stype, otype) |
58 uicfg.rinlined.tag_relation(True, (stype, rtype, otype), role) |
59 else: |
59 else: |
60 raise ValueError(tag) |
60 raise ValueError(tag) |
61 |
61 |
62 except ImportError: |
62 except ImportError: |
63 _dispatch_rtags = None |
63 _dispatch_rtags = None |
125 warn('%s widget is deprecated' % wdgname, DeprecationWarning) |
125 warn('%s widget is deprecated' % wdgname, DeprecationWarning) |
126 continue |
126 continue |
127 if wdgname == 'StringWidget': |
127 if wdgname == 'StringWidget': |
128 wdgname = 'TextInput' |
128 wdgname = 'TextInput' |
129 widget = getattr(formwidgets, wdgname) |
129 widget = getattr(formwidgets, wdgname) |
130 AutomaticEntityForm.rwidgets.set_rtag(wdgname, rtype, 'subject', etype) |
130 assert hasattr(widget, 'render') |
|
131 AutomaticEntityForm.rwidgets.tag_relation( |
|
132 widget, (etype, rtype, '*'), 'subject') |
131 return super(_metaentity, mcs).__new__(mcs, name, bases, classdict) |
133 return super(_metaentity, mcs).__new__(mcs, name, bases, classdict) |
132 |
134 |
133 |
135 |
134 class Entity(AppRsetObject, dict): |
136 class Entity(AppRsetObject, dict): |
135 """an entity instance has e_schema automagically set on |
137 """an entity instance has e_schema automagically set on |