web/formfields.py
changeset 2678 0308dc159b96
parent 2568 87f99ad0d3a8
child 2680 66472d85d548
--- a/web/formfields.py	Tue Aug 04 17:00:14 2009 +0200
+++ b/web/formfields.py	Tue Aug 04 17:01:00 2009 +0200
@@ -14,7 +14,7 @@
 from yams.constraints import (SizeConstraint, StaticVocabularyConstraint,
                               FormatConstraint)
 
-from cubicweb.utils import ustrftime, compute_cardinality
+from cubicweb.utils import ustrftime
 from cubicweb.common import tags, uilib
 from cubicweb.web import INTERNAL_FIELD_VALUE
 from cubicweb.web.formwidgets import (
@@ -490,9 +490,9 @@
     'subjschema rschema objschema' according to information found in the schema
     """
     fieldclass = None
+    card = eschema.cardinality(rschema, role)
     if role == 'subject':
         targetschema = rschema.objects(eschema)[0]
-        card = compute_cardinality(eschema, rschema, role)
         help = rschema.rproperty(eschema, targetschema, 'description')
         if rschema.is_final():
             if rschema.rproperty(eschema, targetschema, 'internationalizable'):
@@ -502,7 +502,6 @@
             kwargs.setdefault('initial', get_default)
     else:
         targetschema = rschema.subjects(eschema)[0]
-        card = compute_cardinality(eschema, rschema, role)
         help = rschema.rproperty(targetschema, eschema, 'description')
     kwargs['required'] = card in '1+'
     kwargs['name'] = rschema.type