I need to be able to access a Postgresql database directly from Zope Python scripts (Z SQL Methods is not an option as the SQL code occurs in modules that must be re-usable in a non-Zope context).

After several attempts at getting the DB-API connection from a Psycopg connection object created in Zope, I tried this in a Zope Python script:

import psycopg
dbcon = psycopg.connect('host=%s dbname=%s user=%s' % ('dbhost', 'dbname', 'username'))

When run outside Zope, it opens a connection as expected. When run in Zope, however, I get "thrown out" - the browser asks me to enter my user name and password again. I get no error message!

Does Zope somehow create a restricted environment where opening a database connection is impossible? Is there a way to bypass that restriction?

Ideally I would like to use the DB-API object from a Zope Psycopg connection object so that it worls within Zope's transactions, but any help at just getting a working connection in any way will be greatly appreciated!

med venlig hilsen / regards

Jørgen Frøjk Kjærsgaard

Metation ApS
systemudvikling * hosting * IT rådgivning

Zope-DB mailing list

Reply via email to