[reledit] honore 'rvid' for attribute relations (closes #1947471)

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset258fc0b4a1e0
branchstable
phasepublic
hiddenno
parent revision#f19e3203dff6 [view] fix TypeError when calling req.view('vid', entity=entity) (closes #1947474)
child revision#c071e0b70bf5 typo
files modified by this revision
web/views/reledit.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1316704852 -7200
# Thu Sep 22 17:20:52 2011 +0200
# Branch stable
# Node ID 258fc0b4a1e08bb945c6915328a23d40b645ef30
# Parent f19e3203dff6b454f9685c10d4346d8e9c2ae90a
[reledit] honore 'rvid' for attribute relations (closes #1947471)

diff --git a/web/views/reledit.py b/web/views/reledit.py
@@ -102,11 +102,15 @@
1                  self._handle_composite(rschema, role, divid, reload, formid, action)
2              else:
3                  self._handle_relation(rschema, role, divid, reload, formid, action)
4 
5      def _handle_attribute(self, rschema, role, divid, reload, action):
6 -        value = self.entity.printable_value(rschema.type)
7 +        rvid = self._rules.get('rvid', None)
8 +        if rvid is not None:
9 +            value = self._cw.view(rvid, entity=self.entity, rtype=rschema.type)
10 +        else:
11 +            value = self.entity.printable_value(rschema.type)
12          if not self._should_edit_attribute(rschema):
13              self.w(value)
14              return
15          form, renderer = self._build_form(self.entity, rschema, role, divid, 'base', reload, action)
16          value = value or self._compute_default_value(rschema, role)