You are not allowed to access ...., even allowing ?!
Hi, I'm writing a Product called "Groupware" which shoud provide minimal Groupware Function. As a Database System I decided to use PostgresQL and my DB-Connection Class (writen in python using psycopg) allready works perfectly (outside Zope). But now I'm not making any progress since serveral days. After I added the Groupware Product in the ZMI, I added a "Python Script" and just added one line to import my DB-Connection Class (Filename DB.py, the class itself I name "database") in the python script: ----- from Products.Groupware.DB import database ---- Then the browser starts a HTTP-Authentification which results in Error Type: Unauthorized Error Value: You are not allowed to access Groupware in this context In my __init__.py I inserted the following lines to allow an import import Groupware from ImageFile import ImageFile from Products.PythonScripts.Utility import allow_module, allow_class from AccessControl import ModuleSecurityInfo, ClassSecurityInfo from Globals import InitializeClass from DB import database allow_class (database) ... ... The DB_Connection Class works ouside Zope what on earth can I do to make it working inside zope? Any help would be greatly appreciated. Bernhard Kahlbacher
----- from Products.Groupware.DB import database ----
Then the browser starts a HTTP-Authentification which results in
Error Type: Unauthorized Error Value: You are not allowed to access Groupware in this context
In my __init__.py I inserted the following lines to allow an import
import Groupware from ImageFile import ImageFile
from Products.PythonScripts.Utility import allow_module, allow_class from AccessControl import ModuleSecurityInfo, ClassSecurityInfo from Globals import InitializeClass
from DB import database allow_class (database)
... ...
The DB_Connection Class works ouside Zope what on earth can I do to make it working inside zope?
Pay close attention to the error message. It's telling you that the *module* is unauthorized for import, which is true. (You have to be allowed at the parent before you can get to the child.) Hit it with an 'allow_module' and see what happens. See also: http://cvs.zope.org/Zope/lib/python/Products/PythonScripts/README.txt?rev=HE... http://www.zopelabs.com/cookbook/991933953 --jcc -- "Code generators follow the 80/20 rule. They solve most of the problems, but not all of the problems. There are always features and edge cases that will need hand-coding. Even if code generation could build 100 percent of the application, there will still be an endless supply of boring meetings about feature design." (http://www.devx.com/java/editorial/15511)
participants (2)
-
Bernhard Kahlbacher -
J Cameron Cooper