Hello, I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple. I use Zope as an application server and my clients do not have access to the ZMI, so I'm not concerned with protection against misuse by my clients. Thanks in advance, -- Luiz Fernando B. Ribeiro
Luiz Fernando B. Ribeiro wrote:
Hello,
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
I use Zope as an application server and my clients do not have access to the ZMI, so I'm not concerned with protection against misuse by my clients.
Thanks in advance,
I recall seeing some documentation about this use case somewhere. I think it was in the folder with the python scripts product. -Jim Washington
----- Original Message ----- From: "Luiz Fernando B. Ribeiro" <luiz@engenhosolucoes.com.br> To: <zope@zope.org> Sent: Friday, June 23, 2006 8:40 AM Subject: [Zope] Import Modules
Hello,
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
I use Zope as an application server and my clients do not have access to the ZMI, so I'm not concerned with protection against misuse by my clients.
This may get you pointed in the right direction: http://plone.org/documentation/how-to/using-unauthorized-modules-in-scripts hth Jonathan
--On 23. Juni 2006 09:40:41 -0300 "Luiz Fernando B. Ribeiro" <luiz@engenhosolucoes.com.br> wrote:
Hello,
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
Check for allow_module(). However this is *not* a solution for all and everything. There are several that will define not work properly with PythonScript (including 're'). If you need unrestricted access to Python: use external method or write a Zope product. If you're in CMF country: check out TrustedExecutables. All other approaches are just the wrong way... -aj
Andreas Jung wrote:
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
Check for allow_module(). However this is *not* a solution for all and everything. There are several that will define not work properly with PythonScript (including 're').
See Products/PythonScripts/README.txt for a description of how to enable regexps in python scripts. Florent -- Florent Guillaume, Nuxeo (Paris, France) Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
Andreas Jung wrote:
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
Check for allow_module(). However this is *not* a solution for all and everything. There are several that will define not work properly with PythonScript (including 're').
See Products/PythonScripts/README.txt for a description of how to enable regexps in python scripts.
Sorry, I meant Products/PythonScripts/module_access_examples.py Florent -- Florent Guillaume, Nuxeo (Paris, France) Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
Florent Guillaume escreveu:
Andreas Jung wrote:
I manage my own servers developing web applications and I would like to remove the import restrictions of python modules in python scripts. Is it possible? How can I allow other modules to be imported? I have been using external modules but it is starting to become nonproductive since I have to create functions to simple problems like md5, re, etc, and just using the needed modules would be much simple.
Check for allow_module(). However this is *not* a solution for all and everything. There are several that will define not work properly with PythonScript (including 're').
See Products/PythonScripts/README.txt for a description of how to enable regexps in python scripts.
Sorry, I meant Products/PythonScripts/module_access_examples.py
Thanks a lot, the instructions in Products/PythonScripts/module_access_examples.py work as expected. I'm amazed that the example given in the Products/PythonScripts/README.txt (using re) doesn't work, why is it there? Thanks all for your time. Luiz Fernando
--On 26. Juni 2006 09:41:44 -0300 "Luiz Fernando B. Ribeiro" <luiz@engenhosolucoes.com.br> wrote:
I'm amazed that the example given in the Products/PythonScripts/README.txt (using re) doesn't work, why is it there?
Why isn't it working? As I stated earlier: allow_module() is not a general solution. It might not work for all modules. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting
participants (5)
-
Andreas Jung -
Florent Guillaume -
Jim Washington -
Jonathan -
Luiz Fernando B. Ribeiro