[primary] handle final relation (eg attribute) in the relations section, and give dispctrl to view's extra kwargs as for non final relation
--- a/web/views/primary.py Tue Aug 10 14:20:21 2010 +0200
+++ b/web/views/primary.py Tue Aug 10 14:21:32 2010 +0200
@@ -130,7 +130,8 @@
for rschema, _, role, dispctrl in self._section_def(entity, 'attributes'):
vid = dispctrl.get('vid', 'reledit')
if rschema.final or vid == 'reledit' or dispctrl.get('rtypevid'):
- value = entity.view(vid, rtype=rschema.type, role=role)
+ value = entity.view(vid, rtype=rschema.type, role=role,
+ initargs={'dispctrl': dispctrl})
else:
rset = self._relation_rset(entity, rschema, role, dispctrl)
if rset:
@@ -153,6 +154,16 @@
def render_entity_relations(self, entity):
for rschema, tschemas, role, dispctrl in self._section_def(entity, 'relations'):
+ if rschema.final:
+ self.w(u'<div class="section">')
+ label = self._rel_label(entity, rschema, role, dispctrl)
+ if label:
+ self.w(u'<h4>%s</h4>' % label)
+ vid = dispctrl.get('vid', 'reledit')
+ entity.view(vid, rtype=rschema.type, role=role, w=self.w,
+ initargs={'dispctrl': dispctrl})
+ self.w(u'</div>')
+ continue
rset = self._relation_rset(entity, rschema, role, dispctrl)
if rset:
try: