[Zope-dev] Thread in ZODB
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 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 -- Dr. Andre P. Meyer http://home.hccnet.nl/a.meyer/ TNO FEL Command & Control and Simulation, http://www.fel.tno.nl/div2/ Delft Cooperation on Intelligent Systems, http://www.decis.nl/ ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Thread in ZODB
The same question was asked and answered ~10 days ago. Search google (1st hit for the error message) and the archives before (cross)post. http://marc.theaimsgroup.com/?t=10807723155&r=1&w=2 Sandor > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Andre Meyer > Sent: Saturday, April 10, 2004 3:34 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: [Zope-dev] Thread in ZODB [...] > I have a multi-threaded Python application that I want to > link to Zope. > Site Error > An error was encountered while publishing this resource. > Error Type: UnpickleableError > Error Value: Cannot pickle objects [...] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: [Zope3-dev] proposal: serving static content faster
On Fri, Apr 09, 2004 at 08:11:20PM -0400, Chris McDonough wrote: > On Fri, 2004-04-09 at 18:02, Paul Winkler wrote: > > That's easy. LocalFS, CMFCore.FSFile, and ExtFile 1.1.3 all read the > > entire file into memory before sending anything back to the client. > > That's why ExtFile 1.4 is so much better - it uses RESPONSE.write() > > with 64k chunks. > > I just don't understand why it's a third the speed of ExtFile 1.1.3 at > the largest file size. You must be talking about my patched versions. I don't understand that either! -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's EGG-LIKE KAZUE! (random hero from isometric.spaceninja.com) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] circular referenced persistent objects
I have the following setup (unrelated lines are omitted): class Deliverer(Folder): def manage_afterAdd(self, item, container): if item is self: self.__ac_local_roles__ = dr_localroles(self) class dr_localroles(Persistent): def __init__(self, dr): self.dr = dr dr_localroles implements a few methods of the dictionary interface, so I can always check the effective settings via the Security/local roles zmi page. In order to computing roles, dr_localroles requires its parent object instance (Deliverer), that's why I store a reference to it as an attribute. Question: - Is there a way for dr_localroles to refer its parent without holding a reference to it or using weak reference? - Is there an equivalent of sys.getrefcount for ZODB persistent objects? Also a note for the archives: I wanted to make sure that if I delete a Deliverer object, it will indeed be removed from ZODB. For this I got the oid of the object, deleted it and than tried to get it back via the oid. The trick is, that you'll only get a POSKeyError if you pack the database and flush the cache. This latter one was not obvious for me. Reagards, Sandor ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )