On Sat, Aug 21, 2004 at 09:23:57AM +0200, Chris Withers wrote:
Jurgen Defurne wrote:
Error Type: InvalidObjectReference Error Value: Attempt to store an object from a foreign database connection error.
You're attempting to storea persistent object in a session this is "bad" (tm).
Does anyone have a clue how I can copy the contents of the query result into a Python array or dictionary in Zope ?
Show us the code of what you're trying to do and maybe we can sugges an alternative...
I don't think that that is necessary anymore. Your comment about the persistent object finally makes everything clear what I have been reading in the Zope documentation, but nowhere in the documentation is it explicitly stated that the result of a query is a persistent object. Also, the comments in the Zope book about "Mounted Transient Object Container Caveats" are not really clear and they certainly give no clue on what to do. However, because of your question about the code, I started thinking 'what is my real objective here ?'. My objective is to create a batch query thing, so that I can browse forward and backward through a query. I have generic procedures for initialising the browsing, going forward and going backward. These take a dictionary of fields and a ZSQL method. The error I made in my code was that a) I do need what I call a 'browse' object, which keeps the reference to the ZSQL method, the number of lines to query and the offset, and this object should (and can) be kept in a session, but b) I do not need to have the result of the query in session storage. This is clearly a mistake. So the lesson is, do not use the session storage for just passing a result! It is much better to declare a global variable myself into which I should pass intermediate values and query results between methods. Thanks for clearing things up and making me think. Regards, Jurgen
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk