[Zope-dev] long-running external python method

Mika, David P (CRD) mika@crdmsx01.crd.ge.com
Fri, 19 May 2000 11:51:10 -0400


I have woes calling a long-running external class method.  The external method must be called after
the 
class instance is constructed, because the method modifies class properties.  Modifications are 
done in the external method using python's urllib pointing to the object's manage_edit DTML method.  
This is done to keep the class updated with progress of this long running process.  The process, by 
the way, is started in a daemon thread so my class_add DTML method can return and (re)display
progress.

I know I'm getting tangled up in DTML namespaces.  For instance, I know I can do the following 
inside my class_add DTML method:

<dtml-with "ZDeform2DClass.createInObjectManager(REQUEST['id'], REQUEST)">
  <dtml-call "propertysheets.SimulationStatus.manage_editProperties(REQUEST)">
  <dtml-call "ZDeformStart()">
</dtml-with>

where ZDeformStart is the external method.  But I can't do this because it's a gamble to assume the
class 
instance is created before the external method tries to call the instance's manage_edit!  I don't
think the class
is committed until the final /dtml-with.  I have tried synching the daemon thread in the external
method,
but this conflicts with Zope pickling...

I would like to do something like: 

<dtml-with "ZDeform2DClass.createInObjectManager(REQUEST['id'], REQUEST)">
  <dtml-call "propertysheets.SimulationStatus.manage_editProperties(REQUEST)">
</dtml-with>

<dtml-call "ZDeform2DClass.ZDeformStart()">

This ensures the class is committed before ZDeformStart is called, but this returns an AttributeError
on 
ZDeformStart.  I don't know how to call this method outside the "with" constructor.  Could someone 
offer a zope-line?  

David Mika
GE Corporate Research & Development
k1-mb 237
One Research Circle
Niskayuna, NY 12309

Ph: 518 387 4223
Fx: 518 387 6232