fix bug when value is None
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 10 Feb 2010 16:32:32 +0100
changeset 4550 d74098d1b69f
parent 4547 5f957e351b0a
child 4551 450804da3ab2
fix bug when value is None
web/formwidgets.py
--- a/web/formwidgets.py	Wed Feb 10 14:31:22 2010 +0100
+++ b/web/formwidgets.py	Wed Feb 10 16:32:32 2010 +0100
@@ -722,11 +722,14 @@
                 value = req.form[field.name]
             else:
                 value = self.typed_value(form, field)
-            try:
-                path, qs = value.split('?', 1)
-            except ValueError:
-                path = value
-                qs = ''
+            if value:
+                try:
+                    path, qs = value.split('?', 1)
+                except ValueError:
+                    path = value
+                    qs = ''
+            else:
+                path = qs = ''
             fqs = u'\n'.join(u'%s=%s' % (k, v) for k, v in req.url_parse_qsl(qs))
         attrs = dict(self.attrs)
         if self.setdomid: