web/formfields.py
changeset 4165 eb9acad29407
parent 4162 d2663bcf5306
child 4166 677e487e691a
--- a/web/formfields.py	Mon Dec 21 20:21:56 2009 +0100
+++ b/web/formfields.py	Mon Dec 21 20:23:56 2009 +0100
@@ -433,7 +433,7 @@
         try:
             return req.data[self]
         except KeyError:
-            fkwargs = {'eidparam': self.eidparam}
+            fkwargs = {'eidparam': self.eidparam, 'role': self.role}
             if self.use_fckeditor(form):
                 # if fckeditor is used and format field isn't explicitly
                 # deactivated, we want an hidden field for the format
@@ -823,6 +823,7 @@
     card = rdef.role_cardinality(role)
     kwargs['required'] = card in '1+'
     kwargs['name'] = rschema.type
+    kwargs['role'] = role
     if role == 'object':
         kwargs.setdefault('label', (eschema.type, rschema.type + '_object'))
     else:
@@ -858,7 +859,6 @@
                     kwargs['%s_field' % metadata] = guess_field(eschema, metaschema,
                                                                 skip_meta_attr=False)
         return fieldclass(**kwargs)
-    kwargs['role'] = role
     return RelationField.fromcardinality(card, **kwargs)