----- Original Message -----
From: "Eric L. Walstad" <[EMAIL PROTECTED]>
Sent: Tuesday, June 13, 2000 12:30 AM
Subject: [Zope] ZClass newbie problem...

> I'm stuck. I would like to build a "shiny new ZClass" that has the
> structure:
> WebSimProduct
>   WebSim Class
>     'Properties' Property Sheet
>       string RunID
>     Calc Class Object
>       'Properties' Property Sheet
>         PathToInputFile
>         PathToWxFolder
>       Results Class Object
>         'Properties' Property Sheet
>           float gashtg
>           float elchtg
>           float elcclg
>           float euihtg
>           float euiclg
> I haven't seen anything in the Zope documentation on using Zclass
> as members of a super class.  In other programming languages I would
> instantiate default objects when the WebSim class is initialized.  That
> to use a WebSim object, all I would need to do is instantiate one, then
> the properties of the automatiacally-created Calc object and Results
> However, I'm not sure how to build these default objects in Zope.
> My next question is: do I have to build a bunch of products (one for the
> Calc class and one for the Results class, for example)?  I can imagine
> would result in a huge number of products under the control panel if this
> the case.  I would like to have just a WebSim product and have all the
> classes defined within this product.  Does Zope work this way?  If not,
> is this class structure (or one similar) achieved?

You can certainly have multiple ZClasses within a single Product. Some
people recommend not nesting ZClasses, because when you do so you can only
use the nested classes within the top level class... ZClasses can't be
cut-and-pasted, so you're stuck with that hierarchy. If you're sure you only
want to add those classes in that particular way, you can pretty easily do
what you want.

In the WebSim_add method, you would do something like:

<dtml-with "createInObjectManager...">        this line is already there
 <dtml-with "Calc_add(_.None, _)">
  ...set your properties here...
   <dtml-with "Results_add(_.None, _)">
     ...set your Results properties here...



Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to