Hello, Christoph.
On Tuesday February 3, 2009 17:03:55 Christoph Zwerschke wrote:
> Using repoze.what.credentials instead of repoze.who.identity sounds like
> a good idea to me, and I will use it in the future. This was however not
> mentioned in the TG 2 docs either (don't expect newbies to read the last
> passage of the last page "inner workings" of the external docs ;-)
Developers shouldn't deal with the repoze.what credentials dict, it's not part
of the repoze.what API, unlike the repoze.who identity dict -- that's what
predicate checkers are for.
I make no compromise about the availability or disposal of anything there.
It's used internally by the built-in predicate checkers and when something
changes in the credentials dict, the built-in predicate checkers are updated
internally, accordingly.
Hence it's described in the "inner-workings". All that stuff if aimed at
people who want to understand better how repoze.what works under the hood.
This is, if you use it, you're using it at your own risk -- just like if you
subclass ClassA and then use one of its private methods that you found after
diving in the source code.
Although it's worth noting that predicates in repoze.what-1.0.4 (not yet
released; current trunk) already support the following:
>>> from repoze.what.predicates import has_permission
>>> p = has_permission('edit-posts')
>>> p.is_met(environ)
True
> Suggestion: Why don't we make repoze.what.credentials accessible as both
> attribute of the request and as a standard template variable in the same
> way as repoze.who.identity? tg.credentials.permissions is a lot simpler
> than tg.request.environ['repoze.what.credentials'].permissions.
Because of what I explained above. repoze.what credentials are not like the
repoze.who identity.
Cheers!
--
Gustavo Narea <http://gustavonarea.net/>.
Get rid of unethical constraints! Get freedomware:
http://www.getgnulinux.org/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---