Commits

Mike Orr committed f38a922

Bugfix in mt.select(): selected values not being passed as list.

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 mt.select(): selected values not being passed as list.
 
 0.6.3 (10/7/2008)
 * Bugfix in distribute() found by Randy Syring.

webhelpers/html/tags.py

         """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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.