use yams.schema method for initial value tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 06 May 2009 17:24:48 +0200
branchtls-sprint
changeset 1709 f7110f533d14
parent 1708 d96a88158b24
child 1710 8c717cc0b353
use yams.schema method for initial value
web/formfields.py
--- a/web/formfields.py	Wed May 06 06:18:34 2009 -0700
+++ b/web/formfields.py	Wed May 06 17:24:48 2009 +0200
@@ -429,7 +429,9 @@
         if rschema.is_final():
             if rschema.rproperty(eschema, targetschema, 'internationalizable'):
                 kwargs['internationalizable'] = True
-            kwargs['initial'] = rschema.rproperty(eschema, targetschema, 'default')
+            def get_default(form, es=eschema, rs=rschema):
+                return es.default(rs)
+            kwargs['initial'] = get_default
     else:
         targetschema = rschema.subjects(eschema)[0]
         card = rschema.rproperty(targetschema, eschema, 'cardinality')[1]