Gustavo Narea schrieb: > On Friday January 30, 2009 12:25:03 Gustavo Narea wrote: >> I think it's better to check the predicate in the controller and then pass >> a boolean variable to the template which tells if the user can see the >> message or not. > > But of course, once evaluate() exists, you'll be able to use it wherever you > want, even in the template.
I think that function would be also useful as a standard template variable (like "auth_stack_enabled" or "identity"). Of course, you can always evaluate in the controller and pass the boolean, or pass the function, but why not provide something to make simple things simple? By the way, checking a permission is not a good use case for this funciton since you can already easily do this in a template using tg.identity.user.permissions(), and you can also easily add a has_permission() method to the user class. The need for such a function comes primarily if you have compound or custom predicate checkers (e.g. checking the ip addr). It's better if you can define them at one place only, and then use them for both restricting access to controllers and changing the behavior of controllers/views. -- Christoph --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
