[Zope] You are not allowed to access ...., even allowing ?!

J Cameron Cooper jccooper at jcameroncooper.com
Thu Sep 4 19:00:00 EDT 2003


>-----
>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=HEAD&content-type=text/vnd.viewcvs-markup
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)





More information about the Zope mailing list