[Zope-CMF] Point of publication

Dieter Maurer dieter@handshake.de
Thu, 18 Apr 2002 21:45:40 +0200


Kevin Carlson writes:
 > Reviving an old thread...
 >=20
 > 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 ha=
ving
 > some trouble.  Any sample source available?
I use the following External Method to move an object to a "DataCenter".

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

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".



Dieter