[Grok-dev] object relationships

Vanderson Mota dos Santos vanderson.mota at gmail.com
Sat Feb 28 16:17:15 EST 2009


Sorry for ressurecting the topic, but please, a tutorial of Object
Relationships is needed, because for now, object relationships are not so
straightforward and fast to make as could/should be, IMHO.

Regards

2009/2/13 Martijn Faassen <faassen at startifact.com>

> Hey,
>
> I'm glad the basics work now. I was able to encapsulate the choice
> behavior quite nicely without too little code. The trick was to derive a
> new RelationChoice field so that the relation is actually indexed
> properly and so you can pass a source to it. The other trick was to
> create a new source factory that you can easily supply with a list of
> targets.
>
> Jeroen Michiel wrote:
> [snip]
> > I still have a small issue if I want to remove my app:
> >  File
> >
> "c:\docume~1\jm\.buildout\eggs\z3c.relationfield-0.4.1-py2.4.egg\z3c\relationfield\event.py",
> > line 36, in removeRelations
> >     catalog = component.getUtility(ICatalog)
> >  File
> >
> "C:\Docume~1\jm\.buildout\eggs\zope.component-3.4.0-py2.4.egg\zope\component\_api.py",
> > line 207, in getUtility
> >     raise ComponentLookupError(interface, name)
> > ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>,
> '')
> >
> > It seems the catalog is unregistered before the objects are removed, or
> > something of that nature...
>
> Yes, it must be some deregistration order issue. I've seen those before
> in other contexts.. I think the issue could be fixed by placing some
> fallback behavior in event.py so that if the catalog is missing things
> will proceed without error. Send me a patch or remind me to look at it
> again. :)
>
> > At least I can write a nice how-to now!
>
> Great!
>
> > BTW: I had already found a nicer way to use a regular choice field with a
> > relation than what I described before, but I'll put it in the how-to as
> > well.
>
> I'd be interested in learning about this too.
>
> > Speaking of how-to's: I already made a how-to on zc.sourcefactory that I
> > submitted for reviewing, but it hasn't been reviewed yet. Do I need to do
> > anything more? Or is this no longer the way how-to's should be submited?
>
> Oh, just make noise on this list when you have something to review, I
> don't think we have people watching what there is to review...
>
> I'll look at it now. That looks like a very nice introduction, so I'll
> publish it right away. Thanks very much for writing it, I think people
> will be helped by this.
>
> Regards,
>
> Martijn
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>



-- 
Vanderson Mota dos Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20090228/6221b7a9/attachment.html 


More information about the Grok-dev mailing list