Please have a look at CPSUtil, where a lot of functions are provided the way you want.

1. put the function in a foo.py file
2. put the proper ModuleSecurityInfo(...).declarePublic(...) to make it importable by restricted code 3. import foo.py from your __init__.py so that the security declaration is read by zope.

Florent


On 16 Mar 2007, at 18:12, Winterflood, Jonathan wrote:

Hi all,

I have a number of .py files in my product that need to use the same set of functions; So far i've been resorting to copy/paste to make them work...

Obviously this isn't a good idea, so i created a file containing (so far) one function this file is placed at the root of my product, and is organised as such:

""" my file's comment
"""

def myfunc():
    """myfunc's comment
    """
    etc...

EOF(myfile.py)

To use this, I'm trying to import it in the .py that's using it:
from myfile import myfunc

This gives me a traceback whenever I try to use it...:
ImportError: import of "csv_render" is unauthorized

What should I do to allow the import?

TIA,
Jonathan
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87



_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to