Mike Orr  committed f38a922

Bugfix in selected values not being passed as list.

  • Participants
  • Parent commits 5a860a8

Comments (0)

Files changed (2)

   the ID entirely, pass ``id=""``.  This is to help set the ID for title().
   radio() doesn't do this because it generates the ID another way.  hidden()
   doesn't because hidden fields aren't used with labels.
+* Bugfix in selected values not being passed as list.
 0.6.3 (10/7/2008)
 * Bugfix in distribute() found by Randy Syring.

File webhelpers/html/

         """Build a dropdown select box or list box.
         See the ``select()`` function for the meaning of the arguments.
-        """
+        If the corresponding database value is not a list or tuple, it's
+        wrapped in a one-element list.  But if it's "" or ``None``, an empty
+        list is substituted.  This is to accommodate multiselect lists, which
+        may have multiple values selected. """
         self._update_id(name, kw)
         selected_values = self._get_value(name, kw)
+        if not isinstance(selected_values, (list, tuple)):
+            if selected_values in ["", None]:
+                selected_values = []
+            else:
+                selected_values = [selected_values]
         return select(name, selected_values, options, **kw)
     def text(self, name, **kw):