Hello,

I can use @pylons.decorators.smth on the controller action without problem:

@pylons.decorators.jsonify
def jsontest2(self):
     return [('spamids', [1,2,3]), ('bigmess',[4]), 
('regular_mail',[5,6,7])]

But when I try this:

def jsontest(self):
    @pylons.decorators.jsonify
    def _jsonout(d):
       return dict(d)
   return _jsonout({'spamids':[1,2,3], 'bigmess':[4], 
'regular_mail':[5,6,7]})

I get AttributeError: 'dict' object has no attribute '_py_object'

And when I try this:

def jsontest(self):
    @pylons.decorators.jsonify
    def _jsonout(fakeself, d):
        return dict(d)
    return _jsonout({'spamids':[1,2,3], 'bigmess':[4], 
'regular_mail':[5,6,7]})

I get TypeError: <lambda>() takes exactly 2 arguments (1 given).

Traceback:

Module helloworld.controllers.world:54 in jsontest

_jsonout        <function _jsonout at 0x01932EB0>
self    <helloworld.controllers.world.WorldController object at 0x01935EF0>
view
<<          def _jsonout(fakeself, d):
                 return dict(d)
             return _jsonout({'spamids':[1,2,3], 'bigmess':[4], 
'regular_mail':[5,6,7]})

         @pylons.decorators.jsonify
 >>  return _jsonout({'spamids':[1,2,3], 'bigmess':[4], 
'regular_mail':[5,6,7]})
TypeError: <lambda>() takes exactly 2 arguments (1 given)



So my question is how do I use built-in Pylons decorators on function 
defined *inside* a controller (or elsewhere in the code, conceivably)?

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