[Zope] A newbie question - ZClasses, contents, and so on...

Carlson, Christopher W. Christopher.W.Carlson@saint-gobain.com
Tue, 12 Jun 2001 14:04:56 -0500


Hi, everybody.  I'm trying to understand just how ZClasses work, and have
decided to create a simple message board system with my ever-so-slowly
growing knowledge.

My model is this:  A forum may contain multiple topics, each of which has a
name.  A topic, in turn, may contain several messages (each of which has an
author and some content).

(Yes, I know that ZDiscussions does this, but perusing the source hasn't
helped me much.)

After flailing at the problem for a while, I've tried two different
approaches.

1) Each of the classes (Forum, Topic, and Message) are created in the
'CForums' product I've made.  Forum and Topic both use ObjectManager as a
base class, so they can contain other items (Topics and Messages,
respectively).  This works well as long as I create Topics and Messages
manually, through the Zope admin screen, but I was unable to discover how to
automate the process so a normal web user could do it.  I simply couldn't
figure out how to get to the Topic methods from within a Forum object, and
so on.

2) Topic is a ZClass in the methods area of Forum, and Message is a ZClass
inside of Topic.  This works well enough, except that I can't specify Topic
as a sub-object of Forum, and so on.  Consequently (at least, I *think* it's
a consequence of this), I can't use things like objectValues or objectIds to
get to the 'contents' of a Forum, even though there are definitely messages
tucked away inside.

How should I be approaching this problem?  I don't really need hand-holding,
but a healthy shove in the right direction would be greatly appreciated.

Thanks for any help you can offer.

--- Chris