I have a grouping function based on what items are selected in a 
multi-select widget. When the user presses a button, an ajax call is made 
to a callback that evaluates the items that have been selected. The 
evaluated item "list" is stored in request.vars.mylist.

Here's the problem. The "list" of values stored in request.vars.mylist may 
or may not be a list. So when I go to evaluate the selected items, I would 
normally do something like this:

for item in request.vars.mylist:
    do_something(int(item))

The problem is this. If only one item is selected, a list is not returned. 
A string is returned instead. So if the request.vars.mylist is a single 
item, '123', then item will be set as if request.vars.mylist were 
['1','2','3'].

Now I know I can easily compensate for that (I'm curious to hear what 
people would suggest as the most efficient method). But why wouldn't that 
be considered an inconsistency that needed fixing?

Reply via email to