[Zope] Adding default methods to a folderish ZClass

estep@ep.newtimes.com estep@ep.newtimes.com
Wed, 17 May 2000 19:20:07 -0000


--- In zope@egroups.com, John Morton <jwm@p...> wrote:

Tres Seaver writes:
 > > Take three. I've solved the problem for all cases by having the
 > > ZClass add method redirect to a method that copies the default
 > > methods into the new ZClass instance, then redirects back to the
 > > management screen.
 > > 
 > > Might have to write a howto for this one.

 > I'm glad you found a workaround.  Just offhand, did you try to just
 > call that additional method, before redirecting to it?  I have seen
 > a couple of cases where I refactored code like that into a new
 > method and then things got simpler.

Tried that - I in-lined it on the list for brevity's sake. The problem
is definitely with manage_clone not wanting to be used on a thing
inside the transaction that creates that thing. 

John.

--- End forwarded message ---

I've tried this workaround, but can't seem to make it work.  In the
ZClass add method, I create the new instance, then pass this instance
to another DTML method to do the cloning.

Could you shed some light on where the ZClass instantiation
transaction ends?  I used an HTML form to get to the DTML method that
would do the cloning, thinking that the submittal of a form would
create another request, thus ending the current transaction. 
Apparently I'm confused about the difference between doing this and
redirecting.

Could you post a code snippet or two of how you did it?

Thanks,
Erik