[uicfg] fix reledit rtag initialization for final relations stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Jan 2011 07:45:52 +0100
branchstable
changeset 6902 20f63f716f0e
parent 6901 118e78f6e4e4
child 6903 d16b42c1e517
[uicfg] fix reledit rtag initialization for final relations
web/uicfg.py
--- a/web/uicfg.py	Thu Jan 27 07:45:14 2011 +0100
+++ b/web/uicfg.py	Thu Jan 27 07:45:52 2011 +0100
@@ -402,23 +402,22 @@
         return super(ReleditTags, self).tag_relation(key, tag)
 
 def init_reledit_ctrl(rtag, sschema, rschema, oschema, role):
-    if rschema.final:
-        return
-    composite = rschema.rdef(sschema, oschema).composite == role
-    if role == 'subject':
-        oschema = '*'
-    else:
-        sschema = '*'
     values = rtag.get(sschema, rschema, oschema, role)
-    edittarget = values.get('edit_target')
-    if edittarget not in (None, 'rtype', 'related'):
-        rtag.warning('reledit: wrong value for edit_target on relation %s: %s',
-                     rschema, edittarget)
-        edittarget = None
-    if not edittarget:
-        edittarget = 'related' if composite else 'rtype'
-        rtag.tag_relation((sschema, rschema, oschema, role),
-                          {'edit_target': edittarget})
+    if not rschema.final:
+        composite = rschema.rdef(sschema, oschema).composite == role
+        if role == 'subject':
+            oschema = '*'
+        else:
+            sschema = '*'
+        edittarget = values.get('edit_target')
+        if edittarget not in (None, 'rtype', 'related'):
+            rtag.warning('reledit: wrong value for edit_target on relation %s: %s',
+                         rschema, edittarget)
+            edittarget = None
+        if not edittarget:
+            edittarget = 'related' if composite else 'rtype'
+            rtag.tag_relation((sschema, rschema, oschema, role),
+                              {'edit_target': edittarget})
     if not 'novalue_include_rtype' in values:
         showlabel = primaryview_display_ctrl.get(
             sschema, rschema, oschema, role).get('showlabel', True)