Carl schrieb:
> TG2 allows me to return only dictionaries exposed as json. If the
> result of a controller method is not a dictionary then it just returns
> it literally. There is an easy workaround:
>
> import simplejson as json
>
> @expose('json')
> def foo(self):
> return json.dumps([1,2,3])
>
>
> However, the whole point of decorators is to handle generic
> boilerplate stuff outside the function/method body. Is there a reason
> for this limitation? Is it a bug?
Why don't you
@expose('json')
def foo(self):
return dict(mylist=[1,2,3])
See also http://trac.turbogears.org/ticket/2034
-- Christoph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---