web/formfields.py
changeset 4252 6c4f109c2b03
parent 4251 3c6569be1f86
parent 4215 9fbc39453012
child 4269 da0d254f2eb0
--- a/web/formfields.py	Mon Jan 18 19:05:08 2010 +0100
+++ b/web/formfields.py	Mon Jan 18 19:21:30 2010 +0100
@@ -1,7 +1,7 @@
 """field classes for form construction
 
 :organization: Logilab
-:copyright: 2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
+:copyright: 2009-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
 """
@@ -380,6 +380,7 @@
 
 class StringField(Field):
     widget = TextArea
+    size = 45
 
     def __init__(self, name=None, max_length=None, **kwargs):
         self.max_length = max_length # must be set before super call
@@ -400,7 +401,7 @@
 
     def init_text_input(self, widget):
         if self.max_length:
-            widget.attrs.setdefault('size', min(45, self.max_length))
+            widget.attrs.setdefault('size', min(self.size, self.max_length))
             widget.attrs.setdefault('maxlength', self.max_length)
 
     def init_text_area(self, widget):