merge tls-sprint
authorsylvain.thenault@logilab.fr
Fri, 20 Feb 2009 17:40:07 +0100
branchtls-sprint
changeset 913 5dfba71b1872
parent 912 9ad0867692e1 (current diff)
parent 910 a86ab461b8fd (diff)
child 936 f54938ba6c60
child 939 ad72e06320e2
merge
web/form.py
--- a/common/tags.py	Fri Feb 20 17:39:56 2009 +0100
+++ b/common/tags.py	Fri Feb 20 17:40:07 2009 +0100
@@ -15,11 +15,14 @@
 label = tag('label')
 option = tag('option')
 
-def select(name, multiple=False, options=[]):
+def select(name, id=None, multiple=False, options=[]):
+    attrs = {}
     if multiple:
-        html = [u'<select name="%s" multiple="multiple">' % name]
-    else:
-        html = [u'<select name="%s">' % name]
+        attrs['multiple'] = 'multiple'
+    if id:
+        attrs['id'] = id
+    html = [u'<select name="%s" %s>' % (name,
+                                        ' '.join('%s="%s"' % kv for kv in attrs.items()))]
     html += options
     html.append(u'</select>')
     return u'\n'.join(html)
--- a/web/form.py	Fri Feb 20 17:39:56 2009 +0100
+++ b/web/form.py	Fri Feb 20 17:40:07 2009 +0100
@@ -275,7 +275,7 @@
             values = (values,)
         attrs = dict(self.attrs)
         attrs['id'] = form.context[field]['id']
-        return name, values, dict(self.attrs)
+        return name, values, attrs
 
 class Input(FieldWidget):
     type = None
@@ -401,6 +401,7 @@
     
     def render(self, form, field):
         txtwidget = super(DateTimePicker, self).render(form, field)
+        self.add_localized_infos(form.req)
         cal_button = self._render_calendar_popup(form, field)
         return txtwidget + cal_button