[Zope-DB] Thread question
Bogdan M. Maryniuck
b.maryniuk at forbis.lt
Wed Jun 23 09:26:23 EDT 2004
This is probably wrong maillist, but this is only I can subscribe...
I have an object, called "pdfBurner" and I need do in PythonScript
something like this:
context.pdfBurner.burn(filename = 'test.pdf')
return "PDF burner in process"
This means, you call this PythonScript and it calls burn() method which
starts separate thread and *immediately* exits to show use the message
"PDF burner in process". OK, but it works for me only once. Next time
File "/opt/Zope-2.6.2/lib/python/ZODB/Connection.py", line 540, in setstate
RuntimeError: Shouldn't load state for '\x00\x00\x00\x00\x00\x04\xf9\x95' when the connection is closed
OK, I know what it means. It appears exactly when I do:
def parseXML(self, xmlDoc):
return xml.dom.minidom.parseString(xmlDoc) # <-- here
Maybe I should parse XML in other way? Or not? But if I do:
lock = ThreadLock.allocate_lock()
...my PythonScript waits until burn() finish, than shows the message.
Since PDF creation takes not-so-short time, browser usually fails with
"Site timeout" -- that's why I exactly want background threads! I don't
care how long my child thread will run, but I care _immediately_ response
to user for PDF in process and he can go drink coffee or something. ;-)
Question: how to run burn process in the Thread, but avoid this exception?
Maybe there is some correct workaround? Can anybody help me here?
Thank you much for advance!
Regards, Bogdan M. Maryniuk
Developer. Forbis UAB
More information about the Zope-DB