let the StringField have a default TextArea widget, only TextInput on small size constraint & no static vocabulary tls-sprint
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 14 May 2009 12:31:23 +0200
branchtls-sprint
changeset 1803 abf40bcb5967
parent 1802 d628defebc17
child 1804 1ce3474dac43
let the StringField have a default TextArea widget, only TextInput on small size constraint & no static vocabulary
web/formfields.py
--- a/web/formfields.py	Thu May 14 11:38:40 2009 +0200
+++ b/web/formfields.py	Thu May 14 12:31:23 2009 +0200
@@ -473,9 +473,10 @@
                     if card in '?1':
                         kwargs['widget'].attrs.setdefault('size', 1)
                 if isinstance(cstr, SizeConstraint) and cstr.max is not None:
-                    if cstr.max > 257:
-                        kwargs.setdefault('widget', TextArea)
+                    if cstr.max < 257:
+                        kwargs.setdefault('widget', TextInput())
                     kwargs['max_length'] = cstr.max
+            kwargs.setdefault('widget', TextArea())
             return StringField(**kwargs)
         if fieldclass is FileField:
             for metadata in ('format', 'encoding'):