[Zope] Complex class structure
J. Cameron Cooper
jccooper at jcameroncooper.com
Fri Nov 21 16:31:02 EST 2003
Andre Meyer wrote:
>Here I have a (silly) question with regard to modelling a rather complex
>class structure in Zope (at least with respect to what I found as
>examples so far).
>
>For my fs/zpt application I have designed a class model (using UML) of a
>music library with some 20 classes (composer, instrument, cast, setting,
>etc.). Most examples of Zope that I found use a single content class
>(like the address book example that uses one entry class). Now I need to
>add instances of my 20+ classes to the application's main class. How
>would I do this? Add 20 dictionaries to the main container class? Or put
>them all in one? What about ids? Use separate names per class or create
>sub-folders? What about cross-links among instances? What about the
>_getitem_ method when I have more than one kind of items to list?
>
>I guess this is again a matter of getting used to the Zope philosophy. I
>come from languages like Java where I know how t do this, but it seems
>to be a bit different in Zope, or not?
>
How would you do it in Java? Chances are you can do it like that in Zope
too. Zope may also give you other options: if you want to allow your
"container class" to contain an arbitary collection of the other types
of classes, you can make it a Folder and simply restrict the meta-types
you can add. Then you can use the regular ObjectManager API (and the
ZMI) to manipulate them. There are products to do relations
(mxmRelations and Archetypes references if under CMF, for example) and
you can always have references by variable.
Can't be more specific than that, I'm afraid, because I don't really
have a good picture of what you're doing. But maybe it'll give you some
ideas.
--jcc
--
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."
More information about the Zope
mailing list