Matt Wilson schrieb:
> I have code like this in a lot of controllers:
> 
> def f(a, b):
> 
>     # Make sure that a is a list.
>     if not isinstance(a, list):
>         a = [a]
> 
> 
>     for x in a:
>         ....
> 
> I have to make sure that a is a list, not a string, before I iterate
> over it.

Use a proper validator:

validator=validators.ForEach(validators.Int(), convert_to_list=True)

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to