final rtags api (eventually :$) tls-sprint
authorsylvain.thenault@logilab.fr
Mon, 11 May 2009 11:20:38 +0200
branchtls-sprint
changeset 1721 694f6a50e138
parent 1720 14c9a0a1aca1
child 1722 62f3fefb22f4
final rtags api (eventually :$)
entity.py
rtags.py
test/unittest_rtags.py
web/test/unittest_views_editforms.py
web/uicfg.py
web/views/autoform.py
web/views/basecomponents.py
web/views/bookmark.py
web/views/boxes.py
web/views/cwproperties.py
web/views/cwuser.py
web/views/primary.py
web/views/schema.py
web/views/workflow.py
--- a/entity.py	Mon May 11 11:01:40 2009 +0200
+++ b/entity.py	Mon May 11 11:20:38 2009 +0200
@@ -51,11 +51,11 @@
     def _dispatch_rtags(tags, rtype, role, stype, otype):
         for tag in tags:
             if tag in _MODE_TAGS:
-                uicfg.rmode.tag_relation(tag, (stype, rtype, otype), role)
+                uicfg.rmode.tag_relation(stype, rtype, otype, tag, role)
             elif tag in _CATEGORY_TAGS:
-                uicfg.rcategories.tag_relation(tag, (stype, rtype, otype), role)
+                uicfg.rcategories.tag_relation(stype, rtype, otype, tag, role)
             elif tag == 'inlineview':
-                uicfg.rinlined.tag_relation(True, (stype, rtype, otype), role)
+                uicfg.rinlined.tag_relation(stype, rtype, otype, True, role)
             else:
                 raise ValueError(tag)
 
@@ -129,7 +129,7 @@
                     widget = getattr(formwidgets, wdgname)
                     assert hasattr(widget, 'render')
                     AutomaticEntityForm.rwidgets.tag_relation(
-                        widget, (etype, rtype, '*'), 'subject')
+                        etype, rtype, '*', widget, tagged='subject')
         return super(_metaentity, mcs).__new__(mcs, name, bases, classdict)
 
 
--- a/rtags.py	Mon May 11 11:01:40 2009 +0200
+++ b/rtags.py	Mon May 11 11:20:38 2009 +0200
@@ -28,8 +28,24 @@
         return self.get(*key)
     __contains__ = __getitem__
 
-    def _get_keys(self, rtype, tagged, stype, otype):
-        assert tagged in ('subject', 'object'), tagged
+    def _get_tagged(self, stype, otype, tagged=None):
+        stype, otype = str(stype), str(otype)
+        if tagged is None:
+            if stype[0] == '!':
+                tagged = 'subject'
+                stype = stype[1:]
+            elif otype[0] == '!':
+                tagged = 'object'
+                otype = otype[1:]
+            else:
+                raise AssertionError('either stype or rtype should have the '
+                                     'role mark ("!")')
+        else:
+            assert tagged in ('subject', 'object'), tagged
+        return stype, otype, tagged
+
+    def _get_keys(self, stype, rtype, otype, tagged=None):
+        stype, otype, tagged = self._get_tagged(stype, otype, tagged)
         keys = [(rtype, tagged, '*', '*'),
                 (rtype, tagged, '*', otype),
                 (rtype, tagged, stype, '*'),
@@ -42,46 +58,43 @@
                 keys.remove((rtype, tagged, stype, '*'))
         return keys
 
-    def tag_attribute(self, tag, stype, attr):
-        self._tagdefs[(str(attr), 'subject', str(stype), '*')] = tag
+    def tag_relation(self, stype, rtype, otype, tag, tagged=None):
+        stype, otype, tagged = self._get_tagged(stype, otype, tagged)
+        self._tagdefs[(str(rtype), tagged, stype, otype)] = tag
 
-    def tag_relation(self, tag, relation, tagged):
-        assert tagged in ('subject', 'object'), tagged
-        stype, rtype, otype = relation
-        self._tagdefs[(str(rtype), tagged, str(stype), str(otype))] = tag
+    def tag_attribute(self, stype, attr, tag):
+        self.tag_relation(stype, attr, '*', tag, tagged)
 
-    def del_rtag(self, relation, tagged):
-        assert tagged in ('subject', 'object'), tagged
-        stype, rtype, otype = relation
-        del self._tagdefs[(str(rtype), tagged, str(stype), str(otype))]
+    def del_rtag(self, stype, rtype, otype):
+        stype, otype, tagged = self._get_tagged(stype, otype)
+        del self._tagdefs[(str(rtype), tagged, stype, otype)]
 
-    def get(self, rtype, tagged, stype='*', otype='*'):
-        for key in reversed(self._get_keys(rtype, tagged, stype, otype)):
+    def get(self, stype, rtype, otype, tagged=None):
+        for key in reversed(self._get_keys(stype, rtype, otype, tagged)):
             try:
                 return self._tagdefs[key]
             except KeyError:
                 continue
         return None
 
-    def etype_get(self, etype, rtype, tagged, ttype='*'):
-        if tagged == 'subject':
-            return self.get(rtype, tagged, etype, ttype)
-        return self.get(rtype, tagged, ttype, etype)
+    def etype_get(self, etype, rtype, role, ttype='*'):
+        if role == 'subject':
+            return self.get(etype, rtype, ttype, role)
+        return self.get(ttype, rtype, etype, role)
 
 
 
 class RelationTagsSet(RelationTags):
     """This class associates a set of tags to each key."""
 
-    def tag_relation(self, tag, relation, tagged):
-        assert tagged in ('subject', 'object'), tagged
-        stype, rtype, otype = relation
+    def tag_relation(self, stype, rtype, otype, tag, tagged=None):
+        stype, otype, tagged = self._get_tagged(stype, otype, tagged)
         rtags = self._tagdefs.setdefault((rtype, tagged, stype, otype), set())
         rtags.add(tag)
 
-    def get(self, rtype, tagged, stype='*', otype='*'):
+    def get(self, stype, rtype, otype, tagged=None):
         rtags = set()
-        for key in self._get_keys(rtype, tagged, stype, otype):
+        for key in self._get_keys(stype, rtype, otype, tagged):
             try:
                 rtags.update(self._tagdefs[key])
             except KeyError:
--- a/test/unittest_rtags.py	Mon May 11 11:01:40 2009 +0200
+++ b/test/unittest_rtags.py	Mon May 11 11:20:38 2009 +0200
@@ -5,14 +5,23 @@
 
     def test_rtags_expansion(self):
         rtags = RelationTags()
-        rtags.tag_relation('primary', ('Societe', 'travaille', '*'), 'subject', )
-        rtags.tag_relation('secondary', ('*', 'evaluee', '*'), 'subject')
-        rtags.tag_relation('generated', ('*', 'tags', '*'), 'object')        
-        self.assertEquals(rtags.get('evaluee', 'subject', 'Note'), 'secondary')
-        self.assertEquals(rtags.get('travaille', 'subject', 'Societe'), 'primary')
-        self.assertEquals(rtags.get('travaille', 'subject', 'Note'), None)
-        self.assertEquals(rtags.get('tags', 'subject', 'Note'), None)
-        self.assertEquals(rtags.get('tags', 'object', 'Note'), 'generated')
+        rtags.tag_relation('!Societe', 'travaille', '*', 'primary')
+        rtags.tag_relation('!*', 'evaluee', '*', 'secondary')
+        rtags.tag_relation('*', 'tags', '!*', 'generated')
+        self.assertEquals(rtags.get('!Note', 'evaluee', '*'),
+                          'secondary')
+        self.assertEquals(rtags.get('Note', 'evaluee', '*', 'subject'),
+                          'secondary')
+        self.assertEquals(rtags.get('!Societe', 'travaille', '*'),
+                          'primary')
+        self.assertEquals(rtags.get('!Note', 'travaille', '*'),
+                          None)
+        self.assertEquals(rtags.get('!Note', 'tags', '*'),
+                          None)
+        self.assertEquals(rtags.get('*', 'tags', '!Note'),
+                          'generated')
+        self.assertEquals(rtags.get('Tag', 'tags', '!*'),
+                          'generated')
 
 #         self.assertEquals(rtags.rtag('evaluee', 'Note', 'subject'), set(('secondary', 'link')))
 #         self.assertEquals(rtags.is_inlined('evaluee', 'Note', 'subject'), False)
@@ -35,11 +44,16 @@
 
     def test_rtagset_expansion(self):
         rtags = RelationTagsSet()
-        rtags.tag_relation('primary', ('Societe', 'travaille', '*'), 'subject', )
-        rtags.tag_relation('secondary', ('*', 'travaille', '*'), 'subject')
-        self.assertEquals(rtags.get('travaille', 'subject', 'Societe'), set(('primary', 'secondary')))
-        self.assertEquals(rtags.get('travaille', 'subject', 'Note'), set(('secondary',)))
-        self.assertEquals(rtags.get('tags', 'subject', 'Note'), set())
+        rtags.tag_relation('!Societe', 'travaille', '*', 'primary')
+        rtags.tag_relation('!*', 'travaille', '*', 'secondary')
+        self.assertEquals(rtags.get('!Societe', 'travaille', '*'),
+                          set(('primary', 'secondary')))
+        self.assertEquals(rtags.get('Societe', 'travaille', '*', 'subject'),
+                          set(('primary', 'secondary')))
+        self.assertEquals(rtags.get('!Note', 'travaille', '*'),
+                          set(('secondary',)))
+        self.assertEquals(rtags.get('!Note', 'tags', "*"),
+                          set())
 
 if __name__ == '__main__':
     unittest_main()
--- a/web/test/unittest_views_editforms.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/test/unittest_views_editforms.py	Mon May 11 11:20:38 2009 +0200
@@ -9,13 +9,12 @@
 class AutomaticEntityFormTC(EnvBasedTC):
 
     def test_custom_widget(self):
-        AEF.rwidgets.tag_relation(AutoCompletionWidget,
-                                  ('CWUser', 'login', '*'), 'subject')
+        AEF.rwidgets.tag_relation('!CWUser', 'login', '*', AutoCompletionWidget)
         form = self.vreg.select_object('forms', 'edition', self.request(), None,
                                        entity=self.user())
         field = form.field_by_name('login')
         self.assertIsInstance(field.widget, AutoCompletionWidget)
-        AEF.rwidgets.del_rtag(('CWUser', 'login', '*'),'subject')
+        AEF.rwidgets.del_rtag('!CWUser', 'login', '*')
 
 
     def test_euser_relations_by_category(self):
--- a/web/uicfg.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/uicfg.py	Mon May 11 11:20:38 2009 +0200
@@ -50,8 +50,8 @@
               'in_state', 'wf_info_for', 'require_permission',
               'from_entity', 'to_entity',
               'see_also'):
-    rdisplay.tag_relation({}, ('*', rtype, '*'), 'subject')
-    rdisplay.tag_relation({}, ('*', rtype, '*'), 'object')
+    rdisplay.tag_relation('!*', rtype, '*', {})
+    rdisplay.tag_relation('*', rtype, '!*', {})
 
 
 # index view configuration ####################################################
@@ -69,25 +69,26 @@
 # relations'category (eg primary/secondary/generic/metadata/generated)
 rcategories = RelationTags()
 # use primary and not generated for eid since it has to be an hidden
-rcategories.tag_relation('primary', ('*', 'eid', '*'), 'subject')
-rcategories.tag_relation('primary', ('*', 'in_state', '*'), 'subject')
-rcategories.tag_relation('secondary', ('*', 'description', '*'), 'subject')
-rcategories.tag_relation('metadata', ('*', 'creation_date', '*'), 'subject')
-rcategories.tag_relation('metadata', ('*', 'modification_date', '*'), 'subject')
-rcategories.tag_relation('metadata', ('*', 'owned_by', '*'), 'subject')
-rcategories.tag_relation('metadata', ('*', 'created_by', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'has_text', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'is', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'is', '*'), 'object')
-rcategories.tag_relation('generated', ('*', 'is_instance_of', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'is_instance_of', '*'), 'object')
-rcategories.tag_relation('generated', ('*', 'identity', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'identity', '*'), 'object')
-rcategories.tag_relation('generated', ('*', 'require_permission', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'wf_info_for', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'wf_info_for', '*'), 'object')
-rcategories.tag_relation('generated', ('*', 'for_user', '*'), 'subject')
-rcategories.tag_relation('generated', ('*', 'for_user', '*'), 'object')
+rcategories.tag_attribute('*', 'eid', 'primary')
+rcategories.tag_attribute('*', 'description', 'secondary')
+rcategories.tag_attribute('*', 'creation_date', 'metadata')
+rcategories.tag_attribute('*', 'modification_date', 'metadata')
+rcategories.tag_attribute('*', 'has_text', 'generated')
+
+rcategories.tag_relation('!*', 'in_state', '*', 'primary')
+rcategories.tag_relation('!*', 'owned_by', '*', 'metadata')
+rcategories.tag_relation('!*', 'created_by', '*', 'metadata')
+rcategories.tag_relation('!*', 'is', '*', 'generated')
+rcategories.tag_relation('*', 'is', '!*', 'generated')
+rcategories.tag_relation('!*', 'is_instance_of', '*', 'generated')
+rcategories.tag_relation('*', 'is_instance_of', '!*', 'generated')
+rcategories.tag_relation('!*', 'identity', '*', 'generated')
+rcategories.tag_relation('*', 'identity', '!*', 'generated')
+rcategories.tag_relation('!*', 'require_permission', '*', 'generated')
+rcategories.tag_relation('!*', 'wf_info_for', '*', 'generated')
+rcategories.tag_relation('*', 'wf_info_for', '!*', 'generated')
+rcategories.tag_relation('!*', 'for_user', '*', 'generated')
+rcategories.tag_relation('*', 'for_user', '!*', 'generated')
 
 # relations'field class
 rfields = RelationTags()
@@ -99,7 +100,7 @@
 # entity(ies) at the other end of the relation will be editable from the
 # form of the edited entity
 rinlined = RelationTags()
-rinlined.tag_relation(True, ('*', 'use_email', '*'), 'subject')
+rinlined.tag_relation('!*', 'use_email', '*', True)
 
 
 # set of tags of the form <action>_on_new on relations. <action> is a
@@ -112,14 +113,14 @@
 
 # 'link' / 'create' relation tags, used to control the "add entity" submenu
 rmode = RelationTags()
-rmode.tag_relation('link', ('*', 'is', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'is', '*'), 'object')
-rmode.tag_relation('link', ('*', 'is_instance_of', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'is_instance_of', '*'), 'object')
-rmode.tag_relation('link', ('*', 'identity', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'identity', '*'), 'object')
-rmode.tag_relation('link', ('*', 'owned_by', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'created_by', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'require_permission', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'wf_info_for', '*'), 'subject')
-rmode.tag_relation('link', ('*', 'wf_info_for', '*'), 'object')
+rmode.tag_relation('!*', 'is', '*', 'link')
+rmode.tag_relation('*', 'is', '!*', 'link')
+rmode.tag_relation('!*', 'is_instance_of', '*', 'link')
+rmode.tag_relation('*', 'is_instance_of', '!*', 'link')
+rmode.tag_relation('!*', 'identity', '*', 'link')
+rmode.tag_relation('*', 'identity', '!*', 'link')
+rmode.tag_relation('!*', 'owned_by', '*', 'link')
+rmode.tag_relation('!*', 'created_by', '*', 'link')
+rmode.tag_relation('!*', 'require_permission', '*', 'link')
+rmode.tag_relation('!*', 'wf_info_for', '*', 'link')
+rmode.tag_relation('*', 'wf_info_for', '!*', 'link')
--- a/web/views/autoform.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/autoform.py	Mon May 11 11:20:38 2009 +0200
@@ -72,7 +72,8 @@
                             category = 'secondary'
                         else:
                             category = 'generic'
-                        cls.rcategories.tag_relation(category, (X, rschema, Y), role)
+                        cls.rcategories.tag_relation((X, rschema, Y, category,
+                                                      tagged=role)
 
     @classmethod
     def erelations_by_category(cls, entity, categories=None, permission=None, rtags=None):
--- a/web/views/basecomponents.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/basecomponents.py	Mon May 11 11:20:38 2009 +0200
@@ -151,8 +151,8 @@
                                                          self.req.property_value('ui.site-title')))
 
 
-uicfg.rdisplay.tag_relation({}, ('*', 'see_also', '*'), 'subject')
-uicfg.rdisplay.tag_relation({}, ('*', 'see_also', '*'), 'object')
+uicfg.rdisplay.tag_relation('!*', 'see_also', '*', {})
+uicfg.rdisplay.tag_relation('*', 'see_also', '!*', {})
 
 class SeeAlsoVComponent(component.RelatedObjectsVComponent):
     """display any entity's see also"""
--- a/web/views/bookmark.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/bookmark.py	Mon May 11 11:20:38 2009 +0200
@@ -14,8 +14,8 @@
 from cubicweb.web import uicfg, action, box, formwidgets
 from cubicweb.web.views import primary
 
-uicfg.rcategories.tag_relation('primary', ('Bookmark', 'path', '*'), 'subject')
-uicfg.rwidgets.tag_relation(formwidgets.TextInput, ('Bookmark', 'path', '*'), 'subject')
+uicfg.rcategories.tag_attribute('!Bookmark', 'path', 'primary')
+uicfg.rwidgets.tag_attribute('Bookmark', 'path', formwidgets.TextInput)
 
 
 class FollowAction(action.Action):
--- a/web/views/boxes.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/boxes.py	Mon May 11 11:20:38 2009 +0200
@@ -64,7 +64,7 @@
                         else:
                             # link mode by default
                             mode = 'link'
-                        cls.rmode.tag_relation(mode, (X, rschema, Y), role)
+                        cls.rmode.tag_relation(X, rschema, Y, mode, tagged=role)
 
     @classmethod
     def relation_mode(cls, rtype, etype, targettype, role='subject'):
--- a/web/views/cwproperties.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/cwproperties.py	Mon May 11 11:20:38 2009 +0200
@@ -339,5 +339,5 @@
         self.widget = wdg
 
 
-uicfg.rfields.tag_relation(PropertyKeyField, ('CWProperty', 'pkey', '*'), 'subject')
-uicfg.rfields.tag_relation(PropertyValueField, ('CWProperty', 'value', '*'), 'subject')
+uicfg.rfields.tag_attribute('CWProperty', 'pkey', PropertyKeyField)
+uicfg.rfields.tag_attribute('CWProperty', 'value', PropertyValueField)
--- a/web/views/cwuser.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/cwuser.py	Mon May 11 11:20:38 2009 +0200
@@ -14,19 +14,18 @@
 from cubicweb.web.views import primary
 
 
-uicfg.rcategories.tag_relation('secondary', ('CWUser', 'firstname', '*'), 'subject')
-uicfg.rcategories.tag_relation('secondary', ('CWUser', 'surname', '*'), 'subject')
-uicfg.rcategories.tag_relation('metadata', ('CWUser', 'last_login_time', '*'), 'subject')
-uicfg.rcategories.tag_relation('primary', ('CWUser', 'in_group', '*'), 'subject')
-uicfg.rcategories.tag_relation('generated', ('*', 'owned_by', 'CWUser'), 'object')
-uicfg.rcategories.tag_relation('generated', ('*', 'created_by', 'CWUser'), 'object')
-uicfg.rcategories.tag_relation('metadata', ('*', 'bookmarked_by', 'CWUser'), 'object')
-uicfg.rmode.tag_relation('create', ('*', 'in_group', 'CWGroup'), 'object')
-uicfg.rmode.tag_relation('link', ('*', 'owned_by', 'CWUser'), 'object')
-uicfg.rmode.tag_relation('link', ('*', 'created_by', 'CWUser'), 'object')
-uicfg.rmode.tag_relation('create', ('*', 'bookmarked_by', 'CWUser'), 'object')
-uicfg.rdisplay.tag_attribute({}, 'CWUser', 'firstname')
-uicfg.rdisplay.tag_attribute({}, 'CWUser', 'surname')
+uicfg.rcategories.tag_attribute('CWUser', 'firstname', 'secondary')
+uicfg.rcategories.tag_attribute('CWUser', 'surname', 'secondary')
+uicfg.rcategories.tag_attribute('CWUser', 'last_login_time', 'metadata')
+uicfg.rcategories.tag_relation('!CWUser', 'in_group', '*', 'primary')
+uicfg.rcategories.tag_relation('*', 'owned_by', '!CWUser', 'generated')
+uicfg.rcategories.tag_relation('*', 'created_by', '!CWUser', 'generated')
+uicfg.rcategories.tag_relation('*', 'bookmarked_by', '!CWUser', 'metadata')
+
+uicfg.rmode.tag_relation('*', 'in_group', '!CWGroup', 'create')
+uicfg.rmode.tag_relation('*', 'owned_by', '!CWUser', 'link')
+uicfg.rmode.tag_relation('*', 'created_by', '!CWUser', 'link')
+uicfg.rmode.tag_relation('*', 'bookmarked_by', '!CWUser', 'create')
 
 
 class UserPreferencesEntityAction(action.Action):
--- a/web/views/primary.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/primary.py	Mon May 11 11:20:38 2009 +0200
@@ -58,8 +58,8 @@
                             where = 'sideboxes'
                         displayinfo = {'where': where,
                                        'order': cls.rdisplay.get_timestamp()}
-                        cls.rdisplay.tag_relation(displayinfo, (X, rschema, Y),
-                                                  role)
+                        cls.rdisplay.tag_relation(X, rschema, Y, displayinfo,
+                                                  tagged=role)
                     if role == 'subject':
                         displayinfo.setdefault('label', rschema.type)
                     else:
--- a/web/views/schema.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/schema.py	Mon May 11 11:20:38 2009 +0200
@@ -19,24 +19,26 @@
 from cubicweb.web.views import TmpFileViewMixin, primary, baseviews
 
 
-uicfg.rcategories.tag_relation('primary', ('CWPermission', 'require_group', '*'), 'subject')
-uicfg.rcategories.tag_attribute('generated', 'EEtype', 'final')
-uicfg.rcategories.tag_attribute('generated', 'ERtype', 'final')
-uicfg.rinlined.tag_relation(True, ('CWRelation', 'relation_type', '*'), 'subject')
-uicfg.rinlined.tag_relation(True, ('CWRelation', 'from_entity', '*'), 'subject')
-uicfg.rinlined.tag_relation(True, ('CWRelation', 'to_entity', '*'), 'subject')
-uicfg.rwidgets.tag_attribute(formwidgets.TextInput, 'RQLExpression', 'expression')
+uicfg.rcategories.tag_relation('!CWPermission', 'require_group', '*', 'primary')
+uicfg.rcategories.tag_attribute('EEtype', 'final', 'generated')
+uicfg.rcategories.tag_attribute('ERtype', 'final', 'generated')
+
+uicfg.rinlined.tag_relation('!CWRelation', 'relation_type', '*', True)
+uicfg.rinlined.tag_relation('!CWRelation', 'from_entity', '*', True)
+uicfg.rinlined.tag_relation('!CWRelation', 'to_entity', '*', True)
 
-uicfg.rmode.tag_relation('create', ('*', 'state_of', 'CWEType'), 'object')
-uicfg.rmode.tag_relation('create', ('*', 'transition_of', 'CWEType'), 'object')
-uicfg.rmode.tag_relation('create', ('*', 'relation_type', 'CWRType'), 'object')
-uicfg.rmode.tag_relation('link', ('*', 'from_entity', 'CWEType'), 'object')
-uicfg.rmode.tag_relation('link', ('*', 'to_entity', 'CWEType'), 'object')
+uicfg.rwidgets.tag_attribute('RQLExpression', 'expression', formwidgets.TextInput)
+
+uicfg.rmode.tag_relation('*', 'state_of', '!CWEType', 'create')
+uicfg.rmode.tag_relation('*', 'transition_of', '!CWEType', 'create')
+uicfg.rmode.tag_relation('*', 'relation_type', '!CWRType', 'create')
+uicfg.rmode.tag_relation('*', 'from_entity', '!CWEType', 'link')
+uicfg.rmode.tag_relation('*', 'to_entity', '!CWEType', 'link')
 
 for attr in ('name', 'meta', 'final'):
-    uicfg.rdisplay.tag_attribute({}, 'CWRType', attr)
+    uicfg.rdisplay.tag_attribute('CWRType', attr, {})
 for attr in ('name', 'meta', 'final', 'symetric', 'inlined'):
-    uicfg.rdisplay.tag_attribute({}, 'CWRType', attr)
+    uicfg.rdisplay.tag_attribute('CWRType', attr, {})
 
 
 class ViewSchemaAction(action.Action):
--- a/web/views/workflow.py	Mon May 11 11:01:40 2009 +0200
+++ b/web/views/workflow.py	Mon May 11 11:20:38 2009 +0200
@@ -25,10 +25,10 @@
 
 _ = unicode
 
-EditBox.rmode.tag_relation('create', ('Transition', 'destination_state', '*'), 'subject')
-EditBox.rmode.tag_relation('create', ('*', 'allowed_transition', 'Transition'), 'object')
-EditBox.rmode.tag_relation('create', ('*', 'destination_state', 'State'), 'object')
-EditBox.rmode.tag_relation('create', ('State', 'allowed_transition', '*'), 'subject')
+EditBox.rmode.tag_relation('!Transition', 'destination_state', '*', 'create')
+EditBox.rmode.tag_relation('*', 'allowed_transition', '!Transition', 'create')
+EditBox.rmode.tag_relation('*', 'destination_state', '!State', 'create')
+EditBox.rmode.tag_relation('!State', 'allowed_transition', '*', 'create')
 
 
 # IWorkflowable views #########################################################