[Zope] Re: Zope digest, Vol 1 #704 - 52 msgs

John Morton jwm@plain.co.nz
Tue, 28 Mar 2000 16:09:57 +1200 (NZST)


Tres Seaver writes:

[I couldn't add default methods to a ZClass instance, Tres provided a method.]

 > The key here may be the inner '<dtml-with newRoot>', which is forcing the
 > newly-created root folder to the top of the namespace stack, so that
 > 'manage_addDTMLMethod()' is being invoked on it, rather than on the
 > sequence-item.
 > 
 > Hope this helps!

Yes and no :-) Your product's add method creates a folder object, then 
switches to it and adds the default methods with each appropriate add
method. What I was trying to do was add a ZClass based product with
the createInObjectManager method, then use manage_clone to copy my
default objects across. 

It turns out I was doing this from the right place (inside the
dtml-with that is used to create the object), but manage_clone is
broken - it let you copy objects into a thing you've just created
inside the same method at all. I'm pretty sure this is a bug - I'd be
interested to know if anyone has actually got this working at all.

In the process of testing this out, I discovered another piece of
unexpected behaviour - you can do this:

<dtml-with "manage_addFolder( rootID, rootTitle )">
</dtml-with>

...and you can then switch to using that object straight away, but if
you do this:

<dtml-with "webDirectory.createInObjectManager(REQUEST['id'], REQUEST)">
</dtml-with>

...the object you've just created doesn't appear to exist as far as
the rest of your dtml method is concerned. 

So I've got something working, using the various object add methods,
but I need to make sure I have one for each type of object in my
default set, and I have a feeling that I'll need to recurse into
folders to add those and their contents. 

Thank,
John.