[Zope-CMF] Point of publication

Kevin Carlson khcarlso@bellsouth.net
Thu, 18 Apr 2002 18:16:01 -0400

Thanks, Dieter.  I'm going to play around with this example this evening and
see if I can get things working.  As always, you're help is greatly


-----Original Message-----
From: Dieter Maurer [mailto:dieter@handshake.de]
Sent: Thursday, April 18, 2002 3:46 PM
To: Kevin Carlson
Cc: zope-cmf@zope.org
Subject: RE: [Zope-CMF] Point of publication

Kevin Carlson writes:
 > Reviving an old thread...
 > I have been able to modify the DefaultWorkflow.py source to accomplish
 > moving an object to a different folder on publication.  Now that I am
 > finally getting around to attempting to do this with a script, I am
 > some trouble.  Any sample source available?
I use the following External Method to move an object to a "DataCenter".

def releaseNew(stateChange):
  obj= stateChange.object
  p= stateChange.getPortal()
  Center= getCenter(p,obj); t= getType(obj)
  # remove the object from its original place - this should uncatalog
  p= obj.aq_inner.aq_parent
  # now install
  n= Center.addObject(obj)
  # finally, tell the workflow that we moved the object
  raise stateChange.ObjectMoved(n,_redirect(n,t + ' freigegeben und ins
DataCenter übertragen'))

The DataCenter has a special method "addObject" that adds an object,
giving it a new automatically generated id.
You can use the "ObjectManager._setObject" method, when the
destination is a standard "ObjectManager".