[Zope] Creating nested ZClass programmatically

Nick Gaunt gauntn@eurobell.co.uk
Fri, 4 Jan 2002 20:52:26 +0000


On Wednesday 02 January 2002 8:40 pm, Kees de Brabander wrote:
> Hi,
> ----- Original Message -----
> From: "Nick Gaunt" <gauntn@eurobell.co.uk>
> To: <zope@zope.org>
> Sent: Wednesday, January 02, 2002 12:33 PM
> Subject: [Zope] Creating nested ZClass programmatically
>
> > Hi
> >
> > First of all, Happy New Year to you all!
>
> from me to
>
> > I am trying to grok ZClasses. I have created a set of classes as follows:
> >
> > StudySite
> >
> >     Study
> >
> >         StudyArm
> >
> >         SubjectFolder
> >
> >             Subject
> >
> > I can create instances of each nested class successfully through the
> > management interface. Now I want users to be able to add instances via a
> > standard user interface, but I cannot work out how to do so. I have users
> > navigate to the desired Study, click an "Add Subject" button that opens a
> > form to collect subject details, click "Add" to open a DTMLMethod, and
>
> then I
>
> > come unstuck - whatever dtml-call syntax I try returns "global name
> > 'StudySite' is not defined". I assume I am not accessing the ZClass
> > namespace, but what is the syntax?
>
> Since you did not share with us the code you used, I'm not sure what your
> problem is, but may be it is the same that I experienced a while ago:
>
>  <dtml-with "manage_addProduct['Productname']">
>    call your class_add method here
>  </dtml-with>
>
> 'Productname' should be the name of your product as it appears in the
> 'Products' folder and not the matatype of your class
> hth, cb

Many thanks, I now understand - I was trying to refer to the class method 
using the path as seen in the management interface,  e.g. 
StudySite/Study/StudyArm_add. For some reason when I tried the syntax above 
using just StudyArm_add it failed, but now it works ;-)

Ah well, I'll put it down to the 'flu I was suffering at the time.

Nick