How to transfer url parameters to repoze custom predicate checkers

Posted by user281521 on Stack Overflow See other posts from Stack Overflow or by user281521
Published on 2010-06-17T18:44:03Z Indexed on 2010/06/18 6:13 UTC
Read the original article Hit count: 317

I would like to create a repoze custom predicate checker that is capable to access url parameters and validate something. But I would like to use allow_only to set this permission checker in all the controller's scope. Something like:

class MyController(BaseController):

    allow_only = All(not_anonymous(msg=l_(u'You must be logged on')),
                     my_custom_predicate(msg=l_(u'something wrong')))

    def index(self, **kw):
        return dict()

then, my_custom_predicate should check the url paramters for every request in every MyController method, and do whatever it do. The problem is just that: how to allow my_custom_predicate to check the url parameters, using it in that way I wrote above.

© Stack Overflow or respective owner

Related posts about python

Related posts about authentication