a bunch of NameError (!) // needs review // tls-sprint
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 12 May 2009 16:38:25 +0200
branchtls-sprint
changeset 1745 7e7f04d19a98
parent 1744 056ed8fca8d3
child 1746 67a9b86fd479
a bunch of NameError (!) // needs review //
web/uicfg.py
--- a/web/uicfg.py	Tue May 12 16:29:52 2009 +0200
+++ b/web/uicfg.py	Tue May 12 16:38:25 2009 +0200
@@ -71,10 +71,16 @@
 
 # primary view configuration ##################################################
 
+def dual_role(role):
+    return 'object' if role == 'subject' else 'subject'
+
 def init_primaryview_section(rtag, sschema, rschema, oschema, role):
     if rtag.get(sschema, rschema, oschema, role) is None:
+        card = rschema.rproperty(sschema, oschema, 'cardinality')
+        card = card[0] if role == 'subject' else card[1]
+        composed = rschema.rproperty(sschema, oschema, 'composite') == dual_role(role)
         if rschema.is_final():
-            if rschema.meta or tschema.type in ('Password', 'Bytes'):
+            if rschema.meta or oschema.type in ('Password', 'Bytes'):
                 section = 'hidden'
             else:
                 section = 'attributes'
@@ -111,7 +117,7 @@
 
     def tag_relation(self, key, tag):
         assert isinstance(tag, dict)
-        super(RDisplayRelationTags, self).tag_relation(key, tag)
+        super(DisplayCtrlRelationTags, self).tag_relation(key, tag)
         self._counter += 1
         tag.setdefault('order', self._counter)