[Zope-CMF] Point of publication
Kevin Carlson
khcarlso@bellsouth.net
Tue, 23 Apr 2002 13:02:49 -0400
More info:
It appears that DCWorkflow calls "doActionFor" which in turn calls
"_changeStateOf" (both in DCWorkflow.py). The interesting thing is that the
code for _changeStateOf catches the ObjectMoved exception but doesn't pass
the return value along to doActionFor. In other words, I think my return
value is getting completely lost. Could this be a bug?
I am using Zope 2.5.0 with CMF 1.2 and DCWorkflow 0.4.2
Kevin
-----Original Message-----
From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
Of Dieter Maurer
Sent: Monday, April 22, 2002 2:39 PM
To: Kevin Carlson
Cc: zope-cmf@zope.org
Subject: RE: [Zope-CMF] Point of publication
Kevin Carlson writes:
> Still getting errors when trying to move objects with a script...
> ...
> def moveToRep(stateChange) :
> obj = stateChange.object
> p=stateChange.getPortal()
> dest = p.A
> p=obj.aq_inner.aq_parent
> p._delObject(obj.getId())
> n = dest._setObject(obj.getId(), obj)
> raise stateChange.ObjectMoved(n, _redirect(n, "Moved"))
> ...
> I am getting the following error:
>
> Error Type: NameError
> Error Value: global name '_redirect' is not defined
A crystal clear error message:
The "_redirect" above is undefined, because you did not define
it. In my script, it is defined as
from urllib import quote_plus
def _redirect(obj,msg=None):
r= obj.REQUEST.RESPONSE
url= '%s/view' % obj.absolute_url()
if msg: url+= '?FeedbackSuccessMessage=%s' % quote_plus(msg)
r.redirect(url)
It redirects to the "view" of the moved object. Not sure, that you
want this redirect...
There is another small problem in your script:
"_setObject" does not return the object but its id.
Therefore, you need:
...
id= dest._setObject(...)
n= dest._getOb(id)
....
This remedies the problem you reported in your second mail.
Dieter
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
http://lists.zope.org/mailman/listinfo/zope-cmf
See http://www.zope.org/Products/PTK/Tracker for bug reports and feature
requests