--- a/web/formfields.py Wed Jul 08 19:11:22 2009 +0200
+++ b/web/formfields.py Wed Jul 08 19:47:36 2009 +0200
@@ -14,7 +14,7 @@
from yams.constraints import SizeConstraint, StaticVocabularyConstraint
from cubicweb.schema import FormatConstraint
-from cubicweb.utils import ustrftime
+from cubicweb.utils import ustrftime, compute_cardinality
from cubicweb.common import tags, uilib
from cubicweb.web import INTERNAL_FIELD_VALUE
from cubicweb.web.formwidgets import (
@@ -460,7 +460,7 @@
fieldclass = None
if role == 'subject':
targetschema = rschema.objects(eschema)[0]
- card = rschema.rproperty(eschema, targetschema, 'cardinality')[0]
+ card = compute_cardinality(eschema, rschema, role)
help = rschema.rproperty(eschema, targetschema, 'description')
if rschema.is_final():
if rschema.rproperty(eschema, targetschema, 'internationalizable'):
@@ -470,7 +470,7 @@
kwargs.setdefault('initial', get_default)
else:
targetschema = rschema.subjects(eschema)[0]
- card = rschema.rproperty(targetschema, eschema, 'cardinality')[1]
+ card = compute_cardinality(eschema, rschema, role)
help = rschema.rproperty(targetschema, eschema, 'description')
kwargs['required'] = card in '1+'
kwargs['name'] = rschema.type