[email protected] ha scritto:
> This is under TG 1.08.
>
> I have an exposed function --using expose ()-- that I call using ajax,
> and it returns json.
>
> So far so good.
>
> I'd also like to call this function internally from another function,
> and just get back a regular python dictionary, not a json string.  How
> can I do that?
>
> I know there are a bunch of workarounds:
> - Making an exposed wrapper and separating it into two functions
> - "Loads"ing the json
> - etc.
>
> but they all seem pretty inelegant.
>
> Thanks
>   
    @expose()
  def get_stuff(self, cod_prov=None, format=None):
        res = {} #something
        if format == 'json':
            from turbojson.jsonify import encode
            return encode( res )
        else:
            return res




Glauco

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