[Grok-dev] Re: is automatic context detection harmful?
Uli Fouquet
uli at gnufix.de
Wed Aug 29 09:52:04 EDT 2007
Hi there,
Am Mittwoch, den 29.08.2007, 15:17 +0200 schrieb Martijn Faassen:
[autogeneration of the reference]
>
> I don't think it's a good idea to auto generate a reference of this
> nature. I think we can do much better if we write it by hand.
Yes, too many things to consider, which can not easily be extracted
automatically. Just think of deprecations, code examples, special use
cases etc.
> That said, what I do think would be very useful is if the admin UI
> actually presented the grok directives in its UI.
>
> So, if you go to a particular content object, you'll see something like:
>
> views
>
> * index
>
> * edit
>
> And then if you click on 'index', you'll see something like this:
>
> dotted name: foo.bar.Index
>
> class Index(grok.View):
> grok.name('Index')
> grok.context(SomeClass)
> grok.permission('zope.Public')
>
> i.e. the admin UI shows *all* the explicit settings even if they are
> not explicit int he code. This is a good way to learn about the
> available directives and what they do. In order to show the defaults,
> we could render the directives in a different color if they are
> actually the default and thus don't have to be written out in the
> code.
>
> This takes a bit of reverse engineering of the directive state from
> the state of the component architecture, using the component
> architecture API. To determine whether grok.context can be left out
> the module will also need to be scanned to determine whether there's
> only a single model available, etc. Or actually, I imagine the __grok_
> annotations made on the classes can help to deduce this information.
> If not now, we can always introduce a new one that helps with this.
The docgrok module should support that approach basically. Nevertheless
it's a complex job to do, so please give some time to finish it.
Kind regards,
--
Uli
More information about the Grok-dev
mailing list