Things seem to work with a modified controller:
from decorator import decorator
from pylons import request
from authkit.authorize import PermissionSetupError
from authkit.authorize import NotAuthenticatedError,
NotAuthorizedError
from authkit.authorize import authorize_request as
authkit_authorize_request
def authorize(permission):
"""
This is a decorator which can be used to decorate a Pylons
controller action.
It takes the permission to check as the only argument and can be
used with
all types of permission objects.
"""
def validate(func, self, *args, **kwargs):
def app(environ, start_response):
return func(self, *args, **kwargs)
return permission.check(app, request.environ,
request.environ["pylons.controller"].start_response)
return decorator(validate)
Is that a solution or a workaround?
On 2 Apr., 14:06, Michael Brickenstein <[EMAIL PROTECTED]> wrote:
> Hi!
> I use nested controllers in my TG2 project and have trouble using
> authkits authorize decorator:
>
> [EMAIL PROTECTED](template="orms.templates.form")
> [EMAIL PROTECTED](RemoteUser())
> def show_edit_page_form(self,fill_by_page_label=None):
>
> The decorator works fine in the RootController.
>
> File '/Users/michael/programming/tg2/tg/controllers.py', line 162 in
> _perform_call
> output = controller(*remainder, **dict(params))
> File '<string>', line 1 in <lambda>
> File '/Users/michael/programming/AuthKit/authkit/authorize/
> pylons_adaptors.py', line 32 in validate
> return permission.check(app, request.environ, self.start_response)
> AttributeError: 'PageController' object has no attribute
> 'start_response'
>
> The controllers are nested in such a way
> class RootController(BaseController):
> page_editor=PageController()
>
> Best regards,
> Michael
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---