give a name to rtags instance to ease debugging stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 18 May 2009 19:50:04 +0200
branchstable
changeset 1849 1901fa97f521
parent 1848 981b8dc9e4d0
child 1850 75661f0a691b
give a name to rtags instance to ease debugging
rtags.py
web/uicfg.py
--- a/rtags.py	Mon May 18 19:48:58 2009 +0200
+++ b/rtags.py	Mon May 18 19:50:04 2009 +0200
@@ -24,7 +24,8 @@
     This class associates a single tag to each key.
     """
     _allowed_values = None
-    def __init__(self, initfunc=None, allowed_values=None):
+    def __init__(self, name=None, initfunc=None, allowed_values=None):
+        self._name = name or '<unknown>'
         self._tagdefs = {}
         if allowed_values is not None:
             self._allowed_values = allowed_values
@@ -32,7 +33,7 @@
         register_rtag(self)
 
     def __repr__(self):
-        return repr(self._tagdefs)
+        return '%s: %s' % (self._name, repr(self._tagdefs))
 
     # dict compat
     def __getitem__(self, key):
--- a/web/uicfg.py	Mon May 18 19:48:58 2009 +0200
+++ b/web/uicfg.py	Mon May 18 19:50:04 2009 +0200
@@ -97,8 +97,9 @@
             section = 'sideboxes'
         rtag.tag_relation((sschema, rschema, oschema, role), section)
 
-primaryview_section = RelationTags(init_primaryview_section,
-                                    frozenset(('attributes', 'relations',
+primaryview_section = RelationTags('primaryview_section',
+                                   init_primaryview_section,
+                                   frozenset(('attributes', 'relations',
                                                'sideboxes', 'hidden')))
 for rtype in ('eid', 'creation_date', 'modification_date',
               'is', 'is_instance_of', 'identity',
@@ -140,7 +141,8 @@
         rtag.tag_relation((sschema, rschema, oschema, role), displayinfo)
     displayinfo.setdefault('label', label)
 
-primaryview_display_ctrl = DisplayCtrlRelationTags(init_primaryview_display_ctrl)
+primaryview_display_ctrl = DisplayCtrlRelationTags('primaryview_display_ctrl',
+                                                   init_primaryview_display_ctrl)
 
 
 # index view configuration ####################################################
@@ -178,7 +180,7 @@
             section = 'generic'
         rtag.tag_relation((sschema, rschema, oschema, role), section)
 
-autoform_section = RelationTags(init_autoform_section,
+autoform_section = RelationTags('autoform_section', init_autoform_section,
                                 set(('primary', 'secondary', 'generic',
                                      'metadata', 'generated')))
 # use primary and not generated for eid since it has to be an hidden
@@ -217,7 +219,7 @@
 
 
 # relations'field class
-autoform_field = RelationTags()
+autoform_field = RelationTags('autoform_field')
 
 # relations'field explicit kwargs (given to field's __init__)
 autoform_field_kwargs = RelationTags()
@@ -231,7 +233,7 @@
 # inlined view flag for non final relations: when True for an entry, the
 # entity(ies) at the other end of the relation will be editable from the
 # form of the edited entity
-autoform_is_inlined = RelationTagsBool()
+autoform_is_inlined = RelationTagsBool('autoform_is_inlined')
 autoform_is_inlined.tag_subject_of(('*', 'use_email', '*'), True)
 autoform_is_inlined.tag_subject_of(('CWRelation', 'relation_type', '*'), True)
 autoform_is_inlined.tag_subject_of(('CWRelation', 'from_entity', '*'), True)
@@ -241,7 +243,7 @@
 # set of tags of the form <action>_on_new on relations. <action> is a
 # schema action (add/update/delete/read), and when such a tag is found
 # permissions checking is by-passed and supposed to be ok
-autoform_permissions_overrides = RelationTagsSet()
+autoform_permissions_overrides = RelationTagsSet('autoform_permissions_overrides')
 
 
 # boxes.EditBox configuration #################################################
@@ -254,7 +256,8 @@
                rschema.rproperty(sschema, oschema, 'composite') == role:
             rtag.tag_relation((sschema, rschema, oschema, role), True)
 
-actionbox_appearsin_addmenu = RelationTagsBool(init_actionbox_appearsin_addmenu)
+actionbox_appearsin_addmenu = RelationTagsBool('actionbox_appearsin_addmenu',
+                                               init_actionbox_appearsin_addmenu)
 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is', '*'), False)
 actionbox_appearsin_addmenu.tag_object_of(('*', 'is', '*'), False)
 actionbox_appearsin_addmenu.tag_subject_of(('*', 'is_instance_of', '*'), False)