On 5/7/09 3:01 PM, Shane Hathaway wrote:
> Martin Aspeli wrote:
>> Well... in any case, this discussion is somewhat moot since only
>> framework authors should ever need to write directives or grokkers.
> In that case, you're disagreeing with my position. Let me state it
> differently: if only framework authors write ZCML handlers / grokkers,
> then application authors will be forced to violate DRY in various
> situations. To solve that, the invitation to write new kinds of
> configuration directives should be extended to application authors, not
> just framework authors.
I agree. I think both writing a grokker and writing a ZCML directive are
probably both a little too hard for the casual application developer.
In particular, writing a ZCML directive is actually quite hard; there are no
docs and you need to understand the way zope.schema works. The way ZCML works
is far too overdesigned, and the overdesigned pieces are *badly* designed.
I think it would be more approachable (and therefore "better" on some axis) if
a) ZCML didn't use schemas (declarative is not a win here, as you still need to
write imperative code in the handler, and if you *did* want declarative stuff,
just let the handler call it), b) writing a simple handler was documented
and more availably and c) handlers actually just *returned* something rather
than being called for their side effects. It's also completely bizarre that a
ZCML handler has no easy access to the registry being populated except via
getSiteManager(). It's a mess.
Writing a grokker is "easier" (at least the first one you write) than writing a
ZCML directive because you don't need to understand zope.schema to write a
grokker. But typically grokkers will just turn around and call an existing
handler if one exists for the same purpose, I think.
Repoze-dev mailing list