fix #343630 by getting explicitly TextInput widget for String, also instantiate field to get proper widget configuration stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 10 Jun 2009 12:08:26 +0200
branchstable
changeset 2085 9e279029d7a0
parent 2080 3ea388b5b9d8
child 2086 be76ce00a05e
fix #343630 by getting explicitly TextInput widget for String, also instantiate field to get proper widget configuration
web/views/cwproperties.py
--- a/web/views/cwproperties.py	Wed Jun 10 08:21:38 2009 +0200
+++ b/web/views/cwproperties.py	Wed Jun 10 12:08:26 2009 +0200
@@ -19,7 +19,7 @@
 from cubicweb.web import uicfg, stdmsgs
 from cubicweb.web.form import FormViewMixIn
 from cubicweb.web.formfields import FIELDS, StringField
-from cubicweb.web.formwidgets import Select, Button, SubmitButton
+from cubicweb.web.formwidgets import Select, TextInput, Button, SubmitButton
 from cubicweb.web.views import primary, formrenderers
 
 
@@ -346,12 +346,13 @@
             else:
                 self.choices = vocab
             wdg = Select()
+        elif pdef['type'] == 'String': # else we'll get a TextArea by default
+            wdg = TextInput()
         else:
-            wdg = FIELDS[pdef['type']].widget()
+            field = FIELDS[pdef['type']]()
+            wdg = field.widget
             if pdef['type'] == 'Boolean':
-                self.choices = [(form.req._('yes'), '1'), (form.req._('no'), '')]
-            elif pdef['type'] in ('Float', 'Int'):
-                wdg.attrs.setdefault('size', 3)
+                self.choices = field.vocabulary(form)
         self.widget = wdg