John Lorance schrieb:
> During the course of migrating a TG1 app to TG2 I'm finding that
> validators written to handle some ajax posts are not converting the
> keyword params into a proper dictionary.  For example:
> 
> The code goes something like this:
> 
> @expose("json")
> @validate(MyValidator, error_handler=error_handling_method)
> def sample_ajax_submission_method(self, *args, *kwargs):
>   profile_values = kwargs['profile_value']
> 
> Now in my TG1 app the validators end up creating a dictionary with a
> key of "profile_value"; however, in my TG2 app.. it appears that this
> transformation doesn't occur; so there is no "profile_value" key or
> packaged up data. I would normally expect as a result of the
> validation I would get a new entry in **kw's that is a dictionary:
> {'name' : 'sample_name', 'address': 'sample_address'}
> 
> My validators look something like:
> 
> class ProfileSubmitValidator(validators.Schema):
>     destination_url = validators.UnicodeString(not_empty=True)
>     profile_value = ProfileValueValidator()
> 
> class ProfileValueValidator(validators.Schema):
>     name = validators.UnicodeString(not_empty=True)
>     address = validators.UnicodeString(not_empty=True)
> 
> Sample kwargs: { 'profile_value.name' : u'Sample Name',
> 'profile_value.address' : 'sample address', 'destination_url' :
> 'sample_url'}
> 
> This setup works in TG1, seems like it should work in TG2 and it runs
> w/o errors; just doesn't give me the results I would expect.  I've
> reviewed the FormEncode docs and can't find a clear answer to this
> problem.  Any clarification of how this should or shouldn't work would
> be great.

Just out of curiosity - did you try instantiating the validator? Other 
than that, I can only suggest to set a breakpoint in the 
tg.controllers-module in the validation-code & see what's happening.

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