On Thu, Jan 15, 2009 at 12:46 PM, mk <[email protected]> wrote:
>
> mk wrote:
>
>> So the question is, how can I do that? Do I have to inherit from
>> BaseController in the code in lib/ just to use pylons decorators?
>
> Unfortunately it doesn't work either:
>
> from helloworld.lib.base import BaseController
>
> import pylons.decorators
>
> class JsonIt(BaseController):
>
>     @pylons.decorators.jsonify
>     def __init__(self, objtojsonify):
>         return objtojsonify
>
>
> Same problem, missing _py_object attribute.
>

_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'}



> Regards,
> mk
>
>
> >
>

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