On Jan 16, 2011, at 8:57 AM, rick wrote:
> 
> I have a simple function:
> 
> def simpletest(animals):
>        theAnimals = request.vars["animals"]
>        leng = len(theAnimals)
>        return dict(leng = leng)
> 
> When I call it with two animals:
> http://mySite.com/myApp/default/call/run/simpletest?animals=cat&animals=dog
> .. I get the answer 2, as I would expect
> 
> When I call it with only one animal:
> http://mySite.com/myApp/default/call/run/simpletest?animals=cat
> .. I get the answer 3, the length of the string "cat"
> 
> I would prefer to get a list with only a single value, like ["cat"],
> of length 1.
> What could I do differently to make that happen?

Try: theAnimals = request.vars.getlist("animals")

Reply via email to