--- a/web/views/primary.py Mon Jun 29 14:12:18 2009 +0200
+++ b/web/views/primary.py Thu Jul 02 10:35:03 2009 +0200
@@ -14,10 +14,10 @@
from cubicweb import Unauthorized
from cubicweb.view import EntityView
+from cubicweb.schema import display_name
from cubicweb.web import uicfg
-
class PrimaryView(EntityView):
"""the full view of an non final entity"""
id = 'primary'
@@ -119,7 +119,19 @@
def render_entity_attributes(self, entity, siderelations=None):
for rschema, tschemas, role, dispctrl in self._section_def(entity, 'attributes'):
- vid = dispctrl.get('vid', 'reledit')
+ # don't use reledit as default vid for composite relation
+ if rschema.is_final():
+ defaultvid = 'reledit'
+ # XXX use entity.e_schema.role_rproperty(role, rschema, 'composite', tschemas[0]) once yams > 0.23.0 is out
+ elif role == 'subject' and \
+ rschema.rproperty(entity.e_schema, tschemas[0], 'composite'):
+ defaultvid = 'csv'
+ elif role == 'object' and \
+ rschema.rproperty(tschemas[0], entity.e_schema, 'composite'):
+ defaultvid = 'csv'
+ else:
+ defaultvid = 'reledit'
+ vid = dispctrl.get('vid', defaultvid)
if rschema.is_final() or vid == 'reledit':
value = entity.view(vid, rtype=rschema.type, role=role)
else: