[Zope] Re: ImportError: import unauthorized
Vitaly Markitantov
vm@cit.sh
Mon, 15 Apr 2002 16:39:01 +0300
On Mon, Apr 15, 2002 at 04:08:02PM +0300, Vitaly Markitantov wrote:
> I creates some Script(P7ython) in Zope:
>
> import time.strftime, time.strptime
> # ...
>
> BDate=strftime("%d.%m.%Y",strptime(Person['Birthday'],"%Y-%m-%d"))
> # ...
>
> all looks ok
>
> But when script is executing, i have error message:
>
> ___
> Site Error
>
> An error was encountered while publishing this resource.
>
> ImportError
> Sorry, a site error occurred.
>
> Traceback (innermost last):
> ......
> File /usr/www/Zope/lib/python/Shared/DC/Scripts/Bindings.py, line 342, in _bindAndExec
> (Object: View)
> File /usr/www/Zope/lib/python/Products/PythonScripts/PythonScript.py, line 326, in _exec
> (Object: View)
> (Info: ({'script': <PythonScript instance at 89f2620>, 'context': <Folder instance at 89f2a80>, 'container': <Folder instance at 89f2a80>, 'traverse_subpath': []}, (), {}, None))
> File Script (Python), line 1, in View
> (Object: guard)
> File /usr/www/Zope/lib/python/AccessControl/ZopeGuards.py, line 188, in guarded_import
> ImportError: import of "time.strftime" is unauthorized
> ___
>
> Why it's unauthorised? I run it from manager interface - my role in Zope is Manager
> How can i resolve this problem?
>
In addition, i've done this via External Method
import time
def date2date(mDate):
return time.strftime("%d.%m.%Y",time.strptime(mDate,"%Y/%m/%d"))
it work's, but why this not works for Scrypt(Python)? It seems like, i cannot
import python libraries in Scrypt(Python).
--
Vitaly Markitantov mailto: vm@cit.sh
icq: 117438950 phone: 332-23-90