[ZODB-Dev] accessing the ZODB through External Methods

Chris Withers lists at simplistix.co.uk
Thu Apr 1 11:40:03 EST 2004


(please don't post in HTML)

Hi Zach,

Zachary Butikofer wrote:

> 3.  The External Methods import my custom built classes and create 
> instances of them (This works)
> 4.  The External Methods "import ZODB.config" (This works)

Eep! This is bad! Why are you trying to do this?

> 5.  The problem comes when I try to connect to the datbase using the the 
> functions:
>      "connection = db.open()"
>      "connection.close()"

And this?

Use DBTab in ZOpe 2.6.x and zope.conf on 2.7.x to manipulate multiple ZODBs, 
never try and open a ZODB "by hand" when using Zope...

>       Zope will not run at this point.  My web page gives me the error:
> 
> *Error Type: IOError*
> *Error Value: [Errno 11] Resource temporarily unavailable*

Are you using PCGI or some other kind of CGI? If so, don't, either go to Zope 
direct or put Zope behind Apache and rewriterule your way through (Zope should 
always be behind a proxy server in production situations)

> I am guessing that somehow the ZODB and Zope are stomping on each 
> other's feet.

Correct. Don't do what you're trying to do, explain the problem you're trying to 
solve on the zope at zope.org list and people there will help...

> server side with out any problems.  I thought that External Methods were 
> supposed to allow you to program python scripts on the server side 
> without Zope interfering.

Not at all, Zope's transactional enivonment is still in effect, and the 'self' 
argument to your external method is a persitant object coming from Zope's ZODB.

> the External Methods I only pass strings.  I do not pass any kind of 
> object or class instance.

I don't believe you ;-)

> I am using Zope-2.7.0 and  ZODB-3.2.1 and Python 2.3.3

Zope 2.7.0 already comes with ZODB, make sure your installed ZODB is the same 
version to be on the safe side.

> Is there a better way to store customized objects in the ZODB?  

Yes! Look for the various tutorials on writing Zope Products...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the ZODB-Dev mailing list