[Zope-dev] relations in objects

mlong at datalong.com mlong at datalong.com
Thu Oct 9 23:34:21 EDT 2003


Hi Jason,

I am not a zope developer, I am a semi-new user who started with zope
coming from the same mindset as yourself. One of the biggest challanges(at
least for me) is to wrap your mind around object oriented programming. The
zope database is an object oriented database. This means that you will
want/need to design your product differently than if you were using
mysql/php to present and store your data. Think of the information you
want to track as real world objects, and it is. Then think about how these
real world objects relate to one another. You will start to see a pattern.
Use this pattern to create a hierarchical folder(object) structure. This
structure along with python's object inheritance will allow you to develop
your relationships. Play with zope. Write your product. Discover that you
need to rewrite your product because you did not understand some
fundamentals. Complete the rewrite. Rinse and repeat until you get it
right.

Cheers,
Mike

> 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
>
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope )
>




More information about the Zope-Dev mailing list