[reledit] display value anyway when should not edit attribute/relation stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 12 Oct 2009 12:20:41 +0200
branchstable
changeset 3636 9b16e7b6ba35
parent 3635 a56759c3c99f
child 3637 0a0e86cb5c89
[reledit] display value anyway when should not edit attribute/relation
web/views/editforms.py
--- a/web/views/editforms.py	Mon Oct 12 12:19:58 2009 +0200
+++ b/web/views/editforms.py	Mon Oct 12 12:20:41 2009 +0200
@@ -176,6 +176,7 @@
                 entity, rtype, role, 'edition', default, onsubmit, reload,
                 attrcategories=self.attrcategories)
             if not self.should_edit_attribute(entity, rschema, role, form):
+                self.w(self.entity.printable_value(rtype))
                 return
             value = entity.printable_value(rtype) or default
             self.attribute_form(lzone, value, form,
@@ -183,13 +184,15 @@
         else:
             if rvid is None:
                 rvid = self._compute_best_vid(entity.e_schema, rschema, role)
-            if not self.should_edit_relation(entity, rschema, role, rvid):
-                return
             rset = entity.related(rtype, role)
             if rset:
                 value = self.view(rvid, rset)
             else:
                 value = default
+            if not self.should_edit_relation(entity, rschema, role, rvid):
+                if rset:
+                    self.w(value)
+                return
             onsubmit = ("return inlineValidateRelationForm('%(rtype)s', '%(role)s', '%(eid)s', "
                         "'%(divid)s', %(reload)s, '%(vid)s', '%(default)s', '%(lzone)s');")
             form = self._build_form(