So, that validate decorator works fine except when an incoming value
is None. Despite what the form encode docs say, None is not converted
into an empty list.
But I'm probably doing something wrong. I usually am. Here's my
code:
@validate(validators={'a':validators.ForEach(validators.Int(),
convert_to_list=True),
'b':validators.ForEach(validators.Int(),
convert_to_list=True)})
@expose()
def f(self, a, b):
log.debug("a is %s." % a)
log.debug("b is %s." % b)
return dict(a=a, b=b)
When I hit my app with this GET: http://sprout/f?a=1&a=2&b=
This is what I see in my logs:
2008-02-21 15:25:03,649 controllers DEBUG a is [1, 2].
2008-02-21 15:25:03,650 controllers DEBUG b is None.
And this is what I get in my browser:
{"a": [1, 2], "b": null, "tg_flash": null}
What silly mistake am I making this time?
Matt
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---