Hello,
In addition to protecting your action with a predicate, you want to evaluate
the has_predicate inside that action -- am I right?
If so, you can use a code like this:
"""
from repoze.what.plugins.pylonshq import is_met
# (...)
@ActionProtector(has_permission('post'), cool_denial_handler)
def view(self, id):
# ...
if is_met(has_permission('whatever')):
# Do something
"""
Please let me know if this is not what you want.
Cheers.
On Wednesday April 15, 2009 04:49:31 [email protected] wrote:
> I have a view method which needs to enable certain html for the super
> user to edit/modify/unpublish the content.
>
> def view(self, id):
> identity = request.environ.get('repoze.who.identity')
> db_session = meta.Session()
> data_model = db_session.query(model.DataModel).filter_by
> (id=id).first()
>
> ??????
>
> How to check whether user has appropriate permission to enable html
> tags?
>
> I am successfully using decorator to protect the action like below. I
> want to know how to call has_permission method?
>
> @ActionProtector(has_permission('post'), cool_denial_handler)
> def edit(self, id):
> db_session = meta.Session()
> .....
>
> Thanks
>
>
--
Gustavo Narea <xri://=Gustavo>.
| Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about |
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---