[Zope] "Product" under Zope 2.7.0
Brian Sullivan
briansullivan at coursesbywire.com
Wed Jun 30 15:46:33 EDT 2004
>
>
> I am attempting to convert some stuff running correctly on
> Zope 2.6 to 2.7 under Win2000.
>
> I have a "product" that I created by following the
> instructions for creating products in the "PythonScripts"
> product to allow access to the Python DSV module from
> http://python-dsv.sourceforge.net/. This seems to function
> correctly under 2.6 but under 2.7 the DSV.py module
> apparently fails to convert to byte code ( my understanding
> is this is done on Zope startup when
> required) thereby making the "product" non functional.
>
> I am not exactly sure why this fails though. Any idea how I
> can approach this problem? How can I get more information on
> this apparent failure?
I am still struggling with this issue.
Is there something in 2.7 that would break the PythonScripts model for
creating a new product?
I followed the exact instructions in the Readme.txt supplied in the source:
"The easiest way to make modules available to Python scripts on
your site is to create a new directory in your Products directory
containing an "__init__.py" file. At Zope startup time, this
"product" will be imported, and any module assertions you make
in the __init__.py will take effect. Here's how to do it:
o In your Products directory (either in lib/python of your
Zope installation or in the root of your Zope install,
depending on your deployment model), create a new directory
with a name like "GlobalModules".
o In the new directory, create a file named "__init__.py".
o Edit the __init__.py file, and add calls to the 'allow_module'
function (located in the Products.PythonScripts.Utility module),
passing the names of modules to be enabled for use by scripts.
For example:
# Global module assertions for Python scripts
from Products.PythonScripts.Utility import allow_module
allow_module('base64')
allow_module('re')
allow_module('DateTime.DateTime')
This example adds the modules 'base64', 're' and the 'DateTime'
module in the 'DateTime' package for use by Python scripts. Note
that for packages (dotted names), each module in the package path
will become available to script objects."
I create a directory in the Products directory named DSV. In that directory
I create a file:
__init__.py
with the following contents:
# Global module assertions for Python scripts
from Products.PythonScripts.Utility import allow_module
allow_module('DSV.DSV')
In the DSV directory I have a DSV.py containing the dsv code.
(as I did for 2.6 where it was successful) an attempt to import the module
results in:
Traceback (innermost last):
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module OFS.DTMLDocument, line 128, in __call__
- <DTMLDocument instance at 02F27C80>
- URL:
http://localhost:8080/CASLPO/scripts/admin/browseStudents.dtml/manage_main
- Physical Path: /CASLPO/scripts/admin/browseStudents.dtml
Module DocumentTemplate.DT_String, line 474, in __call__
Module DocumentTemplate.DT_Util, line 198, in eval
- __traceback_info__: REQUEST
Module <string>, line 1, in <expression>
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 323, in _exec
Module None, line 2, in Bulkcreatestudents
- <PythonScript at /CASLPO/scripts/admin/Bulkcreatestudents>
- Line 2
Module AccessControl.ZopeGuards, line 279, in guarded_import
Module AccessControl.ZopeGuards, line 337, in load_module
Module AccessControl.SecurityInfo, line 210, in secureModule
ImportError: No module named DSV
I can't figure out what do or try next. Does the "__init__.py" need to have
something else in it? Does the whole mess have to sit somewhere else ( I
have tried the Products directory in the main Zope and in the instance to no
avail)?
Any assistance appreciated.
More information about the Zope
mailing list