[ZODB-Dev] passing a reference to ZODB around a CGI

Adam adamauckland at gmail.com
Wed Oct 8 10:14:11 EDT 2008


Hi all,

Many thanks for previous help, I've decided to refactor my database and,
in doing so, my application but I'm not sure if I'm accessing the
database correctly.

I've got a custom web CMS written in Python running on ZODB (so does
everyone probably). It's a CGI so each request generates a new instance.
An instance connects to the database, renders the page then disconnects.
On a good day an entire page refresh is in the region of 35ms with
dynamic content.

At the moment, I pass the reference to the dbroot() around everywhere
and each instance binds self.dbroot to it so I can reach it from
anywhere. Is there a better way to reach the database dict from anywhere
within my code? I have a lot of small classes, dynamically called, which
need access to the internet (menu builder, tag list lookups etc).

Many thanks,

Adam Auckland



More information about the ZODB-Dev mailing list