[Zope-dev] creating one ZClass instance in the constructor of another

Brian Lloyd Brian@digicool.com
Thu, 22 Jul 1999 09:48:05 -0400


> Hi Zopistas -
> 
> This is probably a really easy one, but I was wondering if 
> anyone knows
> how to create an instance of one ZClass inside the constructor of a
> different ZClass.  To illustrate with an example:
> 
> I have defined two ZClasses, a ProjectManager and a GuestBook (I
> reimplemented the old Guestbook example product using ZClasses) as
> separate Products (since they are not really intrinsically related).
> I want to use the GuestBook in the ProjectManager, but I can't figure
> out how to create the GuestBook in the ProjectManager's constructor.
> 
> I want to do something like
> 
> <!--#call "GuestBook_add(id)"-->
> 
> in the ProjectManager_add method; however, since the other Product's
> names don't seem to be defined in the namespace of ProjectManager_add,
> this doesn't work.
> 
> Can anyone please tell me the magical solution to this problem?
> 
> 
> --Brian Hooper

This is a little ugly, but it should work (untested). Let me know!

<!--#call "Control_Panel.Products.Guestbook.Guestbook_add(id)"-->


Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com