Re: [SQLObject] SQLObject and Zope 2.7.3/2.8.0a1
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Anders B. O. <an...@br...> - 2004-11-26 17:03:18
|
On Fri, Nov 26, 2004 at 07:39:48PM +0300, Oleg Broytmann wrote: > Ouch! I am not sure about what caused this. My guess is that Zope or > ZODB cannot unpickle connection object. I am not sure if it is possible > to fix the problem. This is probably that "pickle problem" - SQLObject > tables are essentially non-picklable, I am afraid. WHOA! It seems I fixed it! I have in my Backend.py file not set a _connection for any of my SQLObject classes because I want to define that information directly when adding the object to Zope, and I then set it with Backend.People.setConnection and so forth in my main class's __init__. I thought I would give this one simply try to see if it was indeed just a question of restoring the connection (and without knowing whether sqlobject would indeed do what I thought it would do). I moved those .setConnection calls into a method of it's own that is called from __init__ but also from the methods that actually fetch information from SQLObject right before instantiating any SQLObject classes, and it bloody well survives both Zope restarts AND product refreshes now! I know that it might be quite an evil punch in the gut of performance for my app, but so far it is only a few people on our LAN that will use it to interact with a few databases. Later when I need to integrate those databases with a Plone site I can give some more consideration to performance and see if it does indeed hurt performance to reconnect to the db on every db-related-action. Since most normal webapps do one db-connection per page load and this will be almost the same I don't really think it will be that bad performance-wise. -- Anders -----BEGIN GEEK CODE BLOCK----- Version: 3.12 GCS/O d--@ s:+ a-- C++ UL+++$ P++ L+++ E- W+ N(+) o K? w O-- M- V PS+ PE@ Y+ PGP+ t 5 X R+ tv+ b++ DI+++ D+ G e- h !r y? ------END GEEK CODE BLOCK------ PGPKey: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8BFECB41 |