Hello I think you should take a look at repoze.what I haven't really done this myself, but I came across the documentation lately. Check this for example:
http://what.repoze.org/docs/1.0/Manual/Predicates/Evaluating.html Regards Martin 2012/1/19 León Domingo <[email protected]> > Hi, > Simply: > > @expose(...) > @require(....) > def foo(self): > permissions = request.identity['permissions'] > if somepermission in permissions: > do_this() > else: > do_that() > > León Domingo > > Ender - Factoría de Software > [email protected] <[email protected]> > Avda. Cerro del Águila, 7. S23 - 2ª Planta > 28703 S.S. de los Reyes (MADRID) > Tlf. 902 01 44 01 > > <http://www.ender.es/> > <http://www.facebook.com/home.php?#%21/pages/San-Sebastian-de-los-Reyes-Spain/Ender-Factoria-de-Software/142213119143359?ref=ts> > * <http://www.ender.es>* > > > 2012/1/19 Timuçin Kızılay <[email protected]> > >> Hello, >> >> I'm using @require decorator on my controller functions and it works >> fine. But now I need to use predicates inside a controller function. in the >> function, I have a condition based on permissions and do something else >> based on the permission. >> >> I tried this : >> >> p = predicates.has_permission('**somepermission') >> >> if p: >> do something >> else: >> do something else >> >> how can I do this ? is there any example code? I've read the docs and >> I've only seen using with @require decorator. >> >> I've searched the google and found only documents and examples using >> predicates with @require. So, I've decided to ask here. >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "TurboGears" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to turbogears+unsubscribe@** >> googlegroups.com <turbogears%[email protected]>. >> For more options, visit this group at http://groups.google.com/** >> group/turbogears?hl=en <http://groups.google.com/group/turbogears?hl=en>. >> >> > -- > You received this message because you are subscribed to the Google Groups > "TurboGears" 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?hl=en. > -- Martin Eliasson +46 (0) 739 97 87 33 http://asplunden.org -- You received this message because you are subscribed to the Google Groups "TurboGears" 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?hl=en.

