Gustavo Narea schrieb:
> Defining and/or evaluating predicates inside the template is something that 
> I'd consider anti-MVC and anti-DRY prone (see below), nevertheless, I agree 
> that a *similar* ability is necessary but not available by default with 
> repoze.what -- something like:
> """
> <a py:if="can_access('/admin/')" href="/admin/">
>     This is a link for admins
> </a>
> """
> instead of:
> """
> <a py:if="evaluate(in_group('admins'))" href="/admin/">
>     This is a link for admins
> </a>
> """
> 
> The former is not anti-MVC because it's not defining the access condition -- 
> authorization should only be dealt with in the controller, not in the view.

Thanks for answering that, Gustavo. I completely agree that in use cases 
as above, the can_access() function would be a better solution than 
repeating the predicate of the controller. It would be really useful to 
have such a function and I'd appretiate if you could make that happen.

However, I can also imagine use cases where you still want to check 
predicates inside the template (or the controller), e.g. when you want 
to show some additional information on a page only when the user has the 
permission "can_view_additional_info".

-- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to