[ZPT] permissions getting to python modules?
Evan Simpson
evan@zope.com
Sat, 18 Aug 2001 11:47:01 -0400
From: "Chris Curvey" <ccurvey@bellatlantic.net>
> Found it. In order to access module besides string, math and random
from
> ZPT, you need to tell Zope that it's OK to run it.
[snip]
> I'm uncomfortable changing the __init__.py script for someone else's
> product. Is there a way around this?
In this particular case, you probably should be using the Zope
'DateTime' class instead of the Python 'time' module. It has a lot of
date and time formatting options, and is available in Page Templates
either through the path "modules/DateTime/DateTime" or directly in
Python expressions as "DateTime", for example:
"python:DateTime().Date()".
In general, when you want to expose modules to restricted code, you're
best off creating your own Product (just a subdirectory of the Products
directory with an __init__.py) called something like "myModuleSecurity"
and placing the security calls in that.
Cheers,
Evan @ Zope