[uicfg] fix handling of 'order' in the primaryview_display_ctrl rtag: consider by default only schema order, not order of appearance of rules stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 12 May 2010 17:07:07 +0200
branchstable
changeset 5524 2f3d4ca6f7f8
parent 5523 4bf975c049a6
child 5525 c4eee9921e19
child 5600 a826996875e7
[uicfg] fix handling of 'order' in the primaryview_display_ctrl rtag: consider by default only schema order, not order of appearance of rules
web/uicfg.py
--- a/web/uicfg.py	Wed May 12 15:25:17 2010 +0200
+++ b/web/uicfg.py	Wed May 12 17:07:07 2010 +0200
@@ -80,18 +80,13 @@
 primaryview_section = RelationTags('primaryview_section',
                                    init_primaryview_section,
                                    frozenset(('attributes', 'relations',
-                                               'sideboxes', 'hidden')))
+                                              'sideboxes', 'hidden')))
 
 
 class DisplayCtrlRelationTags(RelationTagsDict):
     def __init__(self, *args, **kwargs):
         super(DisplayCtrlRelationTags, self).__init__(*args, **kwargs)
-        self._counter = 0
-
-    def tag_relation(self, key, tag):
-        tag = super(DisplayCtrlRelationTags, self).tag_relation(key, tag)
-        self._counter += 1
-        tag.setdefault('order', self._counter)
+        self.counter = 0
 
     def tag_subject_of(self, key, tag):
         subj, rtype, obj = key
@@ -117,7 +112,8 @@
         sschema = '*'
         label = '%s_%s' % (rschema, role)
     rtag.setdefault((sschema, rschema, oschema, role), 'label', label)
-    rtag.setdefault((sschema, rschema, oschema, role), 'order', rtag._counter)
+    rtag.counter += 1
+    rtag.setdefault((sschema, rschema, oschema, role), 'order', rtag.counter)
 
 primaryview_display_ctrl = DisplayCtrlRelationTags('primaryview_display_ctrl',
                                                    init_primaryview_display_ctrl)