[Grok-dev] Re: New Grok user with some questions
Martijn Faassen
faassen at startifact.com
Wed Jun 25 08:57:11 EDT 2008
Kevin Teague wrote:
>>
>> - I found some references about local utilities but no real
>> documentation about it. Is there some documentation or sample code on
>> how to use local utilities in Grok?
>>
>
> There is a small mention in the Official Grok Reference, but the
> reference isn't finsihed and published on the web site yet:
>
> http://svn.zope.org/grok/trunk/doc/reference/components.rst?rev=82908&view=markup
>
>
> In the absence of documentation, the ftests and tests directories in the
> grok source package make for reasonable examples of how to do things.
> But asking questions on the list is also good, since it has a chance of
> prodding someone into documentating something :)
Yes, for now I think the ftests in Grok are most instructive.
In brief, there is a 'grok.local_utility' directive which you can use on
a grok.Application (or sites in general). When this site is created, it
will automatically create and install the local utility for you.
>> - One of my main problems with ZODB is how to implement m:n relations.
>> I think most people comming from relational databases have this
>> problem and a short how-to would be quite helpfull. Perhaps this would
>> be a nice lighting talk on the Europython 2008? ;-)
>
> lovely.relation (http://svn.zope.org/lovely.relation/) is AFAIK the best
> place to start for modeling many to many relationships (um, M:N to is
> many-to-many)? It's a Zope 3 package built on the lower level
> zc.relationship package. I've only gone far enough with this package to
> create a very simple relationship in Grok 0.12, but maybe once I've used
> it a bit more I'll write up a how-to - there is a fair bit of docs
> within the package itself as well.
I just mentioned my stealth package z3c.relationfield. I just realized
it is actually in Zope's SVN already. It only does 1 to 1 relations
right now, but it does index them and so on, making quite powerful
queries on the relations possible. It also hasn't been publically
released yet. 1 to many relations are still coming.
http://svn.zope.org/z3c.relationfield/trunk/src/z3c/relationfield/README.txt
The nice thing about this package is that it is relatively simple to use
in an existing schema, while it still offers powerful indexing. That
said, I can't promote it too much yet, as it needs a bit more polishing.
Regards,
Martijn
More information about the Grok-dev
mailing list