[Zope-DB] Thread in ZODB

Andreas Jung andreas at andreas-jung.com
Sun Apr 11 06:38:55 EDT 2004


You can't associate thread or locks as *persistent* attributes. Use 
_v_someattribute
instead.

-aj

P.S.  and please no crosspostings

--On Samstag, 10. April 2004 10:33 Uhr +0200 Andre Meyer 
<a.meyer at hccnet.nl> wrote:

> Hi Zopers
>
> Here is a nice challenge, I hope:
>
> I have a multi-threaded Python application that I want to link to Zope.
> The idea is to provide a Web interface for viewing and editing the state
> of multiple threads running in Python. On thread should be associated
> with Zope and act as the "door" between the ZServer and the other threads.
> Unfortunately, I do not manage to create a reference to a thread in the
> Zope product's main class because the ZODB refuses to add it.
> This is the error message when trying to instantiate the product:
>
>
> Site Error
> An error was encountered while publishing this resource.
> Error Type: UnpickleableError
> Error Value: Cannot pickle <type 'thread.lock'> objects
>
>
> And this is the code where it goes wrong:
>
>
> class Zpyse(SimpleFolder):
>       meta_type = "Zpyse"
>        manage_options = (
>         {'label':'Edit', 'action':'manage_main'},
>         {'label':'View', 'action':'index_html'}
>         )
>        index_html = PageTemplateFile('zpt/index_html', globals())
>        def manage_editZpyse(self, title, REQUEST=None):
>         "Method to edit Zpyse instances."
>         self.title = title
>         if REQUEST is not None:
>             return self.index_html(self, REQUEST)
>                def __init__(self, id, title):
>         # Sender/Receiver Test
>         print 'init Zpyse'
>         ams = spyse.getAMS()
> *       self.za = ams.createThread('ZopeThread', 'ZopeThread', globals())
>         qa = ams.createThread('Receiver', 'ReceiverThread', globals())
>         sa = ams.createThread('Sender', 'SenderThread', globals())
>
> * only this goes wrong, the other threads are created (without self.).
>
>
>
> Is there anybody with a good idea about how to handle this?
>
> thanks a lot in advance
> Andre







More information about the Zope-DB mailing list