ensure input widgets are displayed anyway if they get an empty list as values tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 13 May 2009 08:41:23 +0200
branchtls-sprint
changeset 1768 b59b7c422a8a
parent 1767 f0ba5a07e271
child 1769 fb91d2b8a441
child 1771 bb9538d91465
ensure input widgets are displayed anyway if they get an empty list as values
web/formwidgets.py
--- a/web/formwidgets.py	Tue May 12 20:53:45 2009 +0200
+++ b/web/formwidgets.py	Wed May 13 08:41:23 2009 +0200
@@ -71,6 +71,9 @@
         """
         self.add_media(form)
         name, values, attrs = self._render_attrs(form, field)
+        # ensure something is rendered
+        if not values:
+            values = (INTERNAL_FIELD_VALUE,)
         inputs = [tags.input(name=name, value=value, type=self.type, **attrs)
                   for value in values]
         return u'\n'.join(inputs)