On 18 Feb., 14:53, SmokeyD <[EMAIL PROTECTED]> wrote:
> > Now, if I have a controller method, with @expose("json") which returns
> > a dict(form=DataGird(fields=fields),value=value)
> > and then call that controller with ?tg_format=json I get an error from
> > jsonify or something stating that the value is not jsonifiable (does
> > that word exist?;).
> > So instead I return
> > dict(form=DataGird(field=fields).render(value=value). In the template
> > I just use XML(form) to display the form if the controller is called
> > without tg_format=json.

I think, I had the same issue a while ago. I can't remember exactly
now how I solved it. Something to do with wrapping the Widget instance
with something that is jsonifiable, I believe. I don't have the code
here atm. I'll have a look at it tonight and get back to you.

> > I would rather detect in the controller though whether or not it is
> > called with tg_format=json  so I can decide in the controller if it
> > should return the rendered or unrendered form.

>From looking at the source, you might try checking for
self.method._allow_json, but I'm not sure if this works and would be a
hack.

> > Do I make any sense?

Yes ;-)

Chris
--~--~---------~--~----~------------~-------~--~----~
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