[Zope-dev] Order of Form Keys in REQUEST
Hi, How does Zope's REQUEST object decide what order to store the form keys? I've got a form with fields in order a, b, c, d - but in REQUEST.form, they're stored out of order. This is causing quite a big problem, as I'd like to dynamically output the form values in order after the form has been submitted. Any thoughts? Many thanks in advance. :) Sandra. ___ 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] Order of Form Keys in REQUEST
Sandra Chong wrote: How does Zope's REQUEST object decide what order to store the form keys? I've got a form with fields in order a, b, c, d - but in REQUEST.form, they're stored out of order. This is causing quite a big problem, as I'd like to dynamically output the form values in order after the form has been submitted. Dictionary keys are unordered. You need to store the order of the keys somewhere else. Ie. to have a list in your form with the keys in order, Or to name them alphabetically and then sort the keys. regards Max M ___ 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] Question about _v_ attributes and database connections
Marco Bizzarri wrote: What I would like to do is to have an hook to the removal of a _v_ attribute, so that I can perform some action *BEFORE* losing any reference to the object itself. I look at the setattr code in cPersistence.c and tried also to write my own __setattr__, __setattr__ isn't the hook you're looking for.. This is better done in a transcation-hooking type way, a la CTM.py in ZOracleDA... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Sessions and Zope Transactions in standard_error_message
michael wrote: My *guess* is that this error happens when a ZODB conflict error is thrown from Transience while rendering standard_error_message. Oh, riiight. Hmmm, is Zope's handling of transactions in standard_error_message still as fubar'ed as it was? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] About Local File System 1-1-0
Hi again, Thank you for your answer about Specify a domain and leave the password for a user blank. I have other similar question. I am using Local File System 1-1-0, but this version does not allow to view the content when you reference the Local File System in the URL, or when you click on View. Why it can occur? Thanks ! ___ 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] Order of Form Keys in REQUEST
Max M wrote: Dictionary keys are unordered. You need to store the order of the keys somewhere else. Ie. to have a list in your form with the keys in order, Or to name them alphabetically and then sort the keys. ...or just do something like: keys = REQUEST.form.keys() keys.sort() for key in keys: print key print REQUEST.form[key] return printed cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Re: OFS.ObjectManager raising string exceptions?
Stuart Bishop wrote: In 2.7, ObjectManager raises 'Bad Request' most of the time, but in one case actually raises zExceptions.BadRequest. Did this get missed when all the string exceptions were getting replaced, or is it deliberately like this for backwards compatibility? I must've missed it. Please feel free to check in any patch which removes string exceptions, on both the HEAD and the 2.7 branch. Tres. -- === Tres Seaver[EMAIL PROTECTED] Zope Corporation Zope Dealers http://www.zope.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 )
Re: [Zope-dev] Product Access to Files
On 2004-03-10 10:14 AM, Chris Withers is reputed to have said: Ian Beatty wrote: I've been messing around with DTMLFile and ClassicHTMLFile and the like, haven't been able to figure out how to get it to work for arbitrary paths. They also require all my file names end in '.dtml', which is quite a pain. Any suggestions? Local FS? What Sandor said? Apache and rewrite rules? I'm overriding '__getitem__' and using Python's os package to directly access the local file system. I just sniff the file name extension and set the response content-type, then return the contents of the named file. Simple and stupid. I actually delegate the file-serving to a helper class, and use recursion to handle arbitrary-length paths for arbitrary-depth file system hierarchies. Simple, stupid, and inelegant, but it seems to work. FileSystemSite seemed geared towards providing ZMI access to static files. I just want my product to be able to dish out preset files that are part of the product. (If anyone's curious, I'm using a Zope product for a back-end to a Mozilla/XUL front-end. This static file stuff allows the product to provide the XUL, JavaScript, and CSS files needed to define the Mozilla-based interface.) Thanks for all the suggestions. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ 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] About Local File System 1-1-0
If you are on Zope 2.7 make sure you have installed LocalFS-1.1-andreas Get it from http://www.easyleading.org/ Greetings Andreas Juan Javier Carrera Obrero wrote: Hi again, Thank you for your answer about Specify a domain and leave the password for a user blank. I have other similar question. I am using Local File System 1-1-0, but this version does not allow to view the content when you reference the Local File System in the URL, or when you click on View. Why it can occur? Thanks ! ___ 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] test.py
Jeremy Hylton wrote: Make sure App.Product is imported first, so that test.py can work. This change does not affect the old utilities/testrunner.py. This checkin message caused me to notice 'test.py' for the first time. Can you point me to any discussion/docs on it? When did/will it replace testrunner? Shouldn't the python2.2 in the #! line be python2.3? Sorry for the flood of questions, but this and the recent doctest-style tests being checked in have made me wonder if I've been missing a significant shift in testing tech. Cheers, Evan @ 4-am ___ 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] Re: test.py
On Wed, 2004-03-10 at 13:39, Evan Simpson wrote: Jeremy Hylton wrote: Make sure App.Product is imported first, so that test.py can work. This change does not affect the old utilities/testrunner.py. This checkin message caused me to notice 'test.py' for the first time. Can you point me to any discussion/docs on it? When did/will it replace testrunner? Shouldn't the python2.2 in the #! line be python2.3? There is minimal documentation in the test.py docstring. All the command line arguments are described. It's basic strategy for finding tests isn't documented, but I don't think it's too different from testrunner.py. test.py obsoleted testrunner.py as of Zope 2.7. test.py was being used by ZODB3 and Zope3 for a while before it was added to Zope 2.7. I'm not sure which #! line you mean, but I think you're right to say it should be python 2.3. All the software on the head requires python 2.3. Sorry for the flood of questions, but this and the recent doctest-style tests being checked in have made me wonder if I've been missing a significant shift in testing tech. test.py has all sorts of bells and whistle for running tests. It's a lot more flexible than testrunner.py. Jeremy ___ 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] Re: test.py
Hi! Jeremy Hylton wrote: test.py obsoleted testrunner.py as of Zope 2.7. test.py was being used by ZODB3 and Zope3 for a while before it was added to Zope 2.7. Why does setup.py still install testrunner.py, not test.py? And BTW: Could *all* files necessary to run tests be installed? I'm not sure which #! line you mean, but I think you're right to say it should be python 2.3. All the software on the head requires python 2.3. Some grep results from Zope HEAD: setup.py: #! /usr/bin/env python test.py: #! /usr/bin/env python2.2 utilities\check_catalog.py: #!/usr/bin/env python2.1 utilities\requestprofiler.py: #!/usr/bin/env python utilities\compilezpy.py: #!/usr/bin/env python utilities\zpasswd.py: #!/usr/bin/env python utilities\testrunner.py: #! /usr/bin/env python2.2 utilities\ZODBTools\space.py: #! /usr/bin/env python And many tests, some of them still with python1.5, e.g. lib\python\TAL\tests\run.py: #! /usr/bin/env python1.5 Could we have a policy for this? I guess '#! /usr/bin/env python' is easier to keep up to date ... Cheers, Yuppie ___ 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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
michael wrote at 2004-3-10 15:22 +1300: ... I have been trying on and off to recreate this error via brute force loading of the simplest possible site that uses sessions. I failed to see this particular KeyError *until* I tried reading a session variable from standard_error_message. Now I can recreate these quite frequently. This is a well known problem in Zope, lengthy discussed but apparently still not yet fixed... The problem is that error handling starts after the main transaction has been aborted. Aborting or committing a transaction implicitely starts a new transaction. If error handling causes objects to be registered in the transaction (because it writes some objects and this can happen for session variables even when they are only read), this transaction is tainted. As the transaction is not aborted after error handling, the transaction and the modified cache are spilled (independently!) into a later request. As the connection/cache may later end up in a different thread, objects can be invalidated asynchronously. This is disastrous. Zope *MUST* abort (or commit) the transaction after error handling!!! -- Dieter ___ 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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
On Wed, 2004-03-10 at 15:20, Dieter Maurer wrote: michael wrote at 2004-3-10 15:22 +1300: ... I have been trying on and off to recreate this error via brute force loading of the simplest possible site that uses sessions. I failed to see this particular KeyError *until* I tried reading a session variable from standard_error_message. Now I can recreate these quite frequently. This is a well known problem in Zope, lengthy discussed but apparently still not yet fixed... The problem is that error handling starts after the main transaction has been aborted. Aborting or committing a transaction implicitely starts a new transaction. If error handling causes objects to be registered in the transaction (because it writes some objects and this can happen for session variables even when they are only read), this transaction is tainted. As the transaction is not aborted after error handling, the transaction and the modified cache are spilled (independently!) into a later request. As the connection/cache may later end up in a different thread, objects can be invalidated asynchronously. This is disastrous. Zope *MUST* abort (or commit) the transaction after error handling!!! I think the transaction in which the error code operates in should be aborted. There is no other sane thing to do. I think this might be as easy as adding a few strategic get_transaction().abort() calls to various cases in Zope/App/startup.py's zpublisher_exception_hook. I don't have the time to untangle that mess at the moment, but I will enter a collector issue in. - C ___ 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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
Nevermind. http://zope.org/Collectors/Zope/789 and http://zope.org/Collectors/Zope/786 The bug neglector is really living up to its name lately (not pointing fingers, mea culpa). - C On Wed, 2004-03-10 at 15:20, Dieter Maurer wrote: michael wrote at 2004-3-10 15:22 +1300: ... I have been trying on and off to recreate this error via brute force loading of the simplest possible site that uses sessions. I failed to see this particular KeyError *until* I tried reading a session variable from standard_error_message. Now I can recreate these quite frequently. This is a well known problem in Zope, lengthy discussed but apparently still not yet fixed... The problem is that error handling starts after the main transaction has been aborted. Aborting or committing a transaction implicitely starts a new transaction. If error handling causes objects to be registered in the transaction (because it writes some objects and this can happen for session variables even when they are only read), this transaction is tainted. As the transaction is not aborted after error handling, the transaction and the modified cache are spilled (independently!) into a later request. As the connection/cache may later end up in a different thread, objects can be invalidated asynchronously. This is disastrous. Zope *MUST* abort (or commit) the transaction after error handling!!! ___ 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] Re: [ZODB-Dev] Re: BTrees strangeness (was Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
On Wed, 10 Mar 2004 17:50:41 -0500 Chris McDonough [EMAIL PROTECTED] wrote: Nevermind. http://zope.org/Collectors/Zope/789 and http://zope.org/Collectors/Zope/786 The bug neglector is really living up to its name lately (not pointing fingers, mea culpa). 'Bout time fer a bug day I reckon... ;^) -Casey ___ 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] Order of Form Keys in REQUEST
Thank you so much. :D You guys are legends. I will try keeping a separate ordered list and save it in the session for the form handler to refer to. Many thanks again. :) Sandra. -Original Message- From: Chris Withers [mailto:[EMAIL PROTECTED] Sent: Wednesday, 10 March 2004 11:19 PM To: Max M Cc: Sandra Chong; [EMAIL PROTECTED] Subject: Re: [Zope-dev] Order of Form Keys in REQUEST Max M wrote: Dictionary keys are unordered. You need to store the order of the keys somewhere else. Ie. to have a list in your form with the keys in order, Or to name them alphabetically and then sort the keys. ...or just do something like: keys = REQUEST.form.keys() keys.sort() for key in keys: print key print REQUEST.form[key] return printed cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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: [ZODB-Dev] Re: BTrees strangeness (was Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
On Wed, Mar 10, 2004 at 06:14:30PM -0500, Casey Duncan wrote: On Wed, 10 Mar 2004 17:50:41 -0500 Chris McDonough [EMAIL PROTECTED] wrote: Nevermind. http://zope.org/Collectors/Zope/789 and http://zope.org/Collectors/Zope/786 The bug neglector is really living up to its name lately (not pointing fingers, mea culpa). 'Bout time fer a bug day I reckon... ;^) I suggested doing a bug day as part of the pycon z2 sprint, but we haven't really discussed the various sprint proposals in depth yet. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's FORNICATOR BOY! (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 )
Re: [Zope-dev] Order of Form Keys in REQUEST
Sandra Chong wrote: Thank you so much. :D You guys are legends. I will try keeping a separate ordered list and save it in the session for the form handler to refer to. Many thanks again. :) It is easier to save it in a hidden field in the form: input type=hidden name=sorted_keys value=key1,key1,key3,key4 And then you can get it like (PythonScript): sorted_keys = REQUEST['sorted_keys'].split(',') But as far as I remember, a form keps the order of items in it, per the spec. So you could probably do: tal:block tal:repeat=key sorted_keys input type=hidden name=sorted_keys:list tal:attributes=key /tal:block Which you can get like (PythonScript): sorted_keys = REQUEST['sorted_keys'] And I am pretty shure that they are in order. But I could be wrong, so the first approach is probably the safest. Btw. These questions should really be asked on the Zope list, not zope-dev. zope-dev is for subjects regarding the development of zope, while the zope list is for development with Zope. regards Max M ___ 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] Order of Form Keys in REQUEST
Oops, sorry about that. It's hard to tell just by the descriptions on Zope.org which is the best list for what. Thanks for the other tip. :) I'll probably stick with holding a server-side array with the info, though, as I might decide later to dynamically generate the forms (there are a few) using the data held in there. -Original Message- From: Max M [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 March 2004 9:05 AM To: Sandra Chong Cc: [EMAIL PROTECTED] Subject: Re: [Zope-dev] Order of Form Keys in REQUEST Sandra Chong wrote: Thank you so much. :D You guys are legends. I will try keeping a separate ordered list and save it in the session for the form handler to refer to. Many thanks again. :) It is easier to save it in a hidden field in the form: input type=hidden name=sorted_keys value=key1,key1,key3,key4 And then you can get it like (PythonScript): sorted_keys = REQUEST['sorted_keys'].split(',') But as far as I remember, a form keps the order of items in it, per the spec. So you could probably do: tal:block tal:repeat=key sorted_keys input type=hidden name=sorted_keys:list tal:attributes=key /tal:block Which you can get like (PythonScript): sorted_keys = REQUEST['sorted_keys'] And I am pretty shure that they are in order. But I could be wrong, so the first approach is probably the safest. Btw. These questions should really be asked on the Zope list, not zope-dev. zope-dev is for subjects regarding the development of zope, while the zope list is for development with Zope. regards Max M ___ 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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
On Wed, 2004-03-10 at 23:14, michael wrote: Thanks for your excellent isolation here. I don't get a KeyError thrown until *after* at least one rendering of standard_error_message that includes an access to a session variable. And I'm only getting KeyError's for sessions that have had a chance to expire. And that KeyError will be thrown whenever any access is made for the session. (Previously I thought I was *only* seeing KeyError's being thrown from standard_error_message.) I think after provide transaction isolation for the duration of an error, we will not see this symptom occur again. That's the first step, at least. We are going to have a bugathon at the Zope 2 sprint at PyCon 9 days from now, and I will put this high on the list. Would you be willing to test a Zope 2.7 version that contains a fix? Thanks! - C ___ 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: [ZODB-Dev] Re: BTrees strangeness (was [Zope-dev] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please)
On 11/03/2004, at 7:25 PM, Chris McDonough wrote: On Wed, 2004-03-10 at 23:14, michael wrote: Thanks for your excellent isolation here. I don't get a KeyError thrown until *after* at least one rendering of standard_error_message that includes an access to a session variable. And I'm only getting KeyError's for sessions that have had a chance to expire. And that KeyError will be thrown whenever any access is made for the session. (Previously I thought I was *only* seeing KeyError's being thrown from standard_error_message.) I think after provide transaction isolation for the duration of an error, we will not see this symptom occur again. That's the first step, at least. We are going to have a bugathon at the Zope 2 sprint at PyCon 9 days from now, and I will put this high on the list. Would you be willing to test a Zope 2.7 version that contains a fix? Sure. Michael ___ 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] Question about _v_ attributes and database connections
On Wed, Mar 10, 2004 at 02:56:33PM +, Chris Withers wrote: Marco Bizzarri wrote: What I would like to do is to have an hook to the removal of a _v_ attribute, so that I can perform some action *BEFORE* losing any reference to the object itself. I look at the setattr code in cPersistence.c and tried also to write my own __setattr__, __setattr__ isn't the hook you're looking for.. Correct, I discovered that after some digging. This is better done in a transcation-hooking type way, a la CTM.py in ZOracleDA... cheers, Chris I'm trying something inspired to that at the moment... I succeeded in installing an hack, very inspired from your code (but at a much simpler level) and some code in the SecurityManager, where I mantain a dictionary of connections, indexed by the result of thread.get_ident(). Once a thread needs a new connection, either it is present in the dictionary or not. If it is present, give it to the thread and assign that to the _v_database_connection attribute. Otherwise, create a new one, put in the dictionary, and go on as before. Of course this is a (horrible) hack, because if you have more than one ZPsycopg objects you will end with mixed connections (argh!) As a proof of concept however it works, and it is resistent to the refreshing of other products (not the ZPsycopg one). Regards Marco -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- Marco Bizzarri - Amministratore Delegato - Icube S.r.l. Sede: Via Ridolfi 15 - 56124 Pisa (PI), Italia E-mail: [EMAIL PROTECTED] WWW: www.icube.it Tel:(+39) 050 97 02 07 Fax: (+39) 050 31 36 588 pgp0.pgp Description: PGP signature ___ 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 )