[Zope-CMF] DcworkFlow swallows second parameter to ObjectMoved
Shane Hathaway
shane@zope.com
Wed, 04 Sep 2002 16:49:35 -0400
Robert Rottermann wrote:
> Hello,
> I am trying to move an object during a transaction.
> in the transaction script I raise ObjectMoved(neobj, "url to the new
> object") exception.
> However this second parameter gets swallowed later on when ObjectMoved is
> rerisen.
Well, in the current design, you're not supposed to use the second
parameter. It's reserved for use by the "workflow method" stuff.
> This seems to be an error, or did I missunderstand something?
It works, but it's misdesigned. :-)
Dieter Maurer wrote:
> Funny code.
>
> One would expect the author wanted to prevent a reraise
> conciously. But, then, it reraises anyway. It just discards
> the result.
>
> Maybe, you ask Shane why he does this.
The idea is that when a workflowed object has moved, you want to start
manipulating the object in the new place rather than the old. So
DCWorkflow has to catch this exception to know what object to
manipulate, then re-raise it so that outer code also knows to work with
the object in the new place. Perhaps we could hold on to the original
exception and re-raise it, rather than creating a new exception.
I think this oddness goes away if you store workflows independently of
the object, in a "workflow repository". It eliminates the need to raise
ObjectMoved exceptions. I have created a simple workflow repository for
a customer project; anyone interested in the code?
Shane