[Z3-sqlos] Schema declaration for RelatedJoin

Brian Sutherland jinty at web.de
Mon Jun 12 18:29:27 CEST 2006


On Thu, Jun 08, 2006 at 10:15:14PM +0200, Anders Bruun Olsen wrote:
> Hi,
> 
> I'm playing around with sqlos to get to know it better. I have worked a
> little bit with sqlobject in the past and I am porting an old Zope2 app
> I wrote (which uses MySQL to store data) to Zope3 with sqlos. In all
> simplicity it is a database for books. I have defined a person class and
> a book class along with there respective SQLObjectContainer classes. Now
> I need to be able to associate a person with a book to define authors.
> I do that by adding a RelatedJoin attribute to both classes.
> But how do I specify this in my schema?
> I have googled it and it seems that only a russian has written anything
> on the internet with the words sqlos and relatedjoin in the same
> sentence :). I couldn't understand the messages but the code seems to
> suggest using List(value_type=Choice()). But Choice needs a vocabulary,
> which for the person class would of course be BookContainer and
> vice-versa for the book class. But not only are vocabularies quite a
> difficult thing to understand, but in Web Component Development with
> Zope 3, Philipp von Weitershausen writes that vocabularies have been
> deprecated in favor of sources.

I haven't figured out Sources yet (I am still mostly working with old
Zope version), but regularly work with vocabularies. If vocabularies are
deprecated, then I suppose it would be better for you to figure out
sources.

Though once you get used to them vocabularies are not all that bad.

> I have taken a look at ISource but is it
> just enough to declare that my SQLObjectContainers implement ISource?
> And how do I correctly declare the source for Choice?

Sorry, don't know enough about Sources yet to answer this one...

> Am I even close here, or is there a much better way to handle this?

Not that I know of.

-- 
Brian Sutherland

Metropolis - "it's the first movie with a robot. And she's a woman.
              And she's EVIL!!"



More information about the z3-sqlos mailing list