Michael Brickenstein schrieb:
> @Suggestion 4:
> - it doesn't become very clear to the user by reading the code, that
> tg.acess.has_permission('edit') is actually something different than
> importing the permission class in the template and using
> has_permission('edit')
Can you elaborate a bit more?
Where is the permission class (from the data model) used in the latter
expression and why would you want to import it? Importing anything in
templates should be avoided anyway if not absolutely necessary.
Or do you mean passing the has_permission predicate and forgetting to
call the evaluate() function or the is_met() method? That's why
overriding __nonzero__ in the predicate class with either a warning or
an auto evaluation mechanism might still be a good idea.
> - Moreover it really suggests repeat yourself. So defining the
> permission somewhere, decorating the controller with it and importing
> the permission itself in the template would be discouraged.
Where do you see repetiton here? The problem with repetition of the
require() decorator is addressed by #1. Using has_permission directly in
the template is intended for use cases only where you want to hide
certain data (not a link) with a py:if directive in the template.
> I would really appreciate to hear more opionions regarding the topic,
> as all solutions are somehow imperfect.
Yes, I'd also like to hear more opinions.
-- 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
-~----------~----~----~----~------~----~------~--~---