[Zope-dev] relations in objects

Jason Corbett jasoncorbett01 at yahoo.com
Thu Oct 9 20:07:28 EDT 2003


Hello Zope developers,

  I'm a newbie (sorry most people have this curse at
one point or another).  I have read the zope book (or
at least most of it), and the zope developer manual. 
I can't quite figure out how to have relationships
between instances of classes in the database.

  Let me first ask if I'm using zope for the correct
thing.  I see that a lot of zope products deal with
content management, while mine doesn't really. 
Basically I want to do what I would normally do with
mysql and php, but use zope instead.  So I need a way
to reference in some intelligent way between objects
in zope, and I need a way to query for a list of them.

  I read about ZCatalogs, etc and how you can use that
for querying and indexing.  That isn't my first
priority, so I'll worry about that a little later.

  Basically I have an instance of a class 'A'.  As
part of it I need to reference either a single or in
some cases multiple instances of class 'B'.  Basically
I'll have a mix of one-to-one relations and
one-to-many.  When I'm coding my python class (I'm
going to do a product if you can't tell), how would I
get a list of the 'B' instances that relate to this
object, and how would I store that?  The zope
developer manual was pretty good for writing classes,
and making views on it, but I need to be able to call
methods on those instances and return lists of them.

  Sorry for the long email, I just don't want to leave
details out.  If you think I'm barking up the wrong
tree, and shouldn't be using zope for this, don't be
afraid to let me know.  Although I will be pretty
disappointed, I think zope is exactly what I've been
looking for, I can't find anything like it in any
other language.

Jason Corbett

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com



More information about the Zope-Dev mailing list