[Zope-DB] How to import SQL in python script?

Dieter Maurer dieter@handshake.de
Mon, 10 Feb 2003 20:50:46 +0100

eijgnit@netscape.net wrote at 2003-2-10 00:05 -0500:
 > Hi, I would like to use python to dynamically query a database. I refer to the book, "Zope Bible" by Michael R. Bernstein, SCott Robertson, and the Codeit Development Team on page 353, it says the simplest way to import the SQL Method class is with:
 >     from Products.ZSQLMethods.SQL import SQL
 > However, when I do that, Zope will prompt me to login (and no account I used could work), and once I click on cancel, I got this error:
 > Error Type: Unauthorized
 > Error Value: You are not allowed to access SQL in this context
Do it in an External Method or learn how to allow imports in
Python Scripts (--> Zope Developers Guide, "README" in product "PythonScripts").