I've got a little Product that does some init hacks.  One of the
things I want to do is expose a couple of python fuctions such that
they can be imported into pythonscripts.  After much spelunking in
the mailing list and the PythonMethods wiki on zope.org, I *think*
that what I need to do is something like this:

from AccessControl import ModuleSecurityInfo

security = ModuleSecurityInfo()

from cccheck import stripCardNum, verifyCardNumber


Now, that SignedEditions one is my attempt to solve the following
error message when I attempt to do 'from SignedEditions import stripCardNum':

Error Type: ImportError
Error Value: import of "SignedEditions" is unauthorized

However, it does not solve the problem.

Hmm.  I just noticed that I forgot to prefix that with "Products.".
Which would seem to make that error message a bug, since SignedEditions
shouldn't exist in the import path.  If I do

from Products.SignedEditions import stripCardNum

then ZDebug tells me:

Unauthorized: Access denied for <module 'Products.SignedEditions' from 
'/usr/local/zope/sites/signededitions/Products/SignedEditions/__init__.py'> because 
its container, <module 'Products' from 
'/usr/local/zope/Zope231b1/lib/python/Products/__init__.pyc'>, has no security 

What do I need to do to assert that it is OK to import from the
SignedEditions product? The wiki does not seem to address this
question at all, though it implies that it is possible, since it
*does* talk about the above assertions to declare things *inside*
the product as importable.

(Oh, BTW, I tried changing 'security' to "ZopeSecurity", but that didn't
seem to change the behavior).


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to