fix editable_attributes bug (closes #1534802)

authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
changesetb07ee816bffb
branchstable
phasepublic
hiddenno
parent revision#f26a1cbddc91 [testlib] New assertion method assertSentEmail() to test presence of emails in system mailbox
child revision#b8ce2266d026 [repo] fix multi-threads bug with get_option_value: pyro proxy can't be used from a thread to another without caution (closes #1535206)
files modified by this revision
web/views/autoform.py
# HG changeset patch
# User Alexandre Fayolle <alexandre.fayolle@logilab.fr>
# Date 1299669890 -3600
# Wed Mar 09 12:24:50 2011 +0100
# Branch stable
# Node ID b07ee816bffbb2c06d997340681c6995e3b30985
# Parent f26a1cbddc9143db8df3b433aa5ce4875b533330
fix editable_attributes bug (closes #1534802)

diff --git a/web/views/autoform.py b/web/views/autoform.py
@@ -783,11 +783,12 @@
1              self.edited_entity, self.formtype, section, permission, strict)
2 
3      def editable_attributes(self, strict=False):
4          """return a list of (relation schema, role) to edit for the entity"""
5          if self.display_fields is not None:
6 -            return self.display_fields
7 +            schema = self._cw.vreg.schema
8 +            return [(schema[rtype], role) for rtype, role in self.display_fields]
9          if self.edited_entity.has_eid() and not self.edited_entity.cw_has_perm('update'):
10              return []
11          # XXX we should simply put eid in the generated section, no?
12          return [(rtype, role) for rtype, _, role in self._relations_by_section(
13              'attributes', 'update', strict)]