On Jan 15, 4:10 am, mk <[email protected]> wrote:
> Gael Pasgrimaud wrote:
> > _py_object is not defined at this this. __init__ is a special case.
> > You can only use @jsonify on a controller action.
>
> > Try:
>
> > class JsonController(BaseController):
>
> >     @jsonify
> >     def data(self):
> >         return {'test':'values'}
>
> It still doesn't work:
>
> from helloworld.lib.base import BaseController
>
> import pylons.decorators
>
> class JsonIt(BaseController):
>
>     �[email protected]
>      def data(self):
>          return {'abc':123}
>
> I call it like that in controller:
>
>      def jsontest3(self):
>          return helloworld.lib.projlib.JsonIt().data()
>
> Again, the error msg is "AttributeError: 'JsonIt' object has no
> attribute '_py_object'"

This is the Wrong Way to do this. If you just want a uniform JSON
response, define a @jsonify decorated method in your BaseController. I
replied to one of your other posts with an example.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to