Import your predicate inside the myapp.lib.helpers module, you will be able to access it as h.predicate inside all the templates.
As predicates raise exceptions I would also create an helper to make eadier to use it in py:if clauses On May 9, 2011 6:50 AM, "Rodrigo Parra" <[email protected]> wrote: > Hi all, > > I want to check for permissions in a template because I want the page > displayed to be slightly different according to them. (For example, a > link being displayed only if the user is a manager). > > However, the authorization method for my application is a bit more > complex than repoze.what standard one, so I had to define new > predicate checkers in order to implement it. > > I defined my own predicate checkers at myproject.lib.mypredchecks.py > (just an example). I had no trouble importing that to my controllers, > but I don't know how to use them on Genshi templates. > > I found this old thread about a similar issue, but the thread is about > repoze.what built-in predicate checkers: > > https://groups.google.com/group/turbogears/browse_thread/thread/ce6fc5df0a303267?hl=es > > Is there a way to do what I need, preferably without passing other > object through the controller? > > Thanks in advance. > > -- > 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. > -- 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.

