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

Charlie Clark charlie@begeistert.org
Mon, 10 Feb 2003 10:20:42 +0100


On 2003-02-10 at 06:05:45 [+0100], eijgnit@netscape.net wrote:
> Hi, I would like to use python to dynamically query a database.
...
> import the SQL Method class is with:
>     from Products.ZSQLMethods.SQL import SQL
> 
> Error Value: You are not allowed to access SQL in this context
> 
> How do I set the permissions such that I could import the SQL object? I 
> don't have access to the LINUX system to modify the SQL.py file.

Could you provide a bit more detail about what you're trying to do? It 
sounds like you might be trying to use some Python module in a part of Zope 
that doesn't allow it; that's why Zope's security doesn't let you. You 
don't need to worry about the operating system permissions on the SQL.py 
file. It's normally best to use a ZSQL-method do the work and call this 
from a PageTemplate or a PythonScript. Importing the module directly is 
more relevant for external methods, I think.

Charlie