m at moshez.org
Mon Jul 21 05:19:15 EDT 2003
On Mon, 21 Jul 2003, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
> For the record, I think this code is awful, and I am sad that my lack
> of time for documentation has made something like this necessary.
I disagree it was a documentation problem -- it was an overhead problem.
webhappyrealm has a *lot* of code related to authentication, compared
to code related to the problem domain. In doc/examples/simpleguard*.py,
even though the code of the problem domain is short [greeting people
we know, insulting people we don't] it is still about half or more
of the code.
In Plonk, which was my original use-case, using simpleguard meant that
we *removed* lots of code, and only changed one method (Blob.writerp).
Note that even if you do use simpleguard, you can still graduate to
use guard itself if and when you need the power [for example, having
something more complicated than authed/non-authed, or using the
same Realm for non-web uses]. You can do that, for example, by
inheriting from MarkingRealm and overriding methods in it.
Your code will still be able to use things like
request.getComponent(Authenticated).name to get the username of logged
in user, so the resources themselves will not have to be modified.
So, I think of the simpleguard/guard decision as "make easy things
easy, make difficult things possible". webhappyrealm shows how to make
difficult things possible -- simpleguard examples show how to make
easy things easy.
Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.
Agile Programming Language -- http://www.python.org/
More information about the Twisted-Python