RE: [Zope] Re: First python script in zope - import problem (permissions)
I added a script object and directly pinched the code that Jason sent: import DateTime return DateTime.DateTime().millis() and it seems to be working. It is strange that it does though. I see in the help (Control_Panel/Products/PythonScripts/Help/ModuleAccess.stx) that "string, math, and random" are availible for import, but "The only way to make other Python modules available for import is to add security declarations to them in the filesystem". Not sure if they intended this to mean the whole list or just a subset. Josh -----Original Message----- From: Dan Shafer [mailto:dan@gui.com] Sent: Friday, December 21, 2001 10:40 PM To: zope@zope.org Subject: [Zope] Re: First python script in zope - import problem (permissions) Joshua Lanza wrote:
I have created a new script object called get_timestamp. I put the following code in there:
import time return int(time.time())
When I try to test it, I get user and password prompt and Unauthorized. Something else I need to do?=20
I don't think you can do time-based stuff in a Python script in Zope. On p. 153 of the Zope Book, it outlines the fairly tight restrictions on what you can import into Python from inside Zope and the time stuff is not listed. You _can_ do this with an External Method, assuming you have proper access rights to the outside-Zope portion of your server. -- Dan Shafer, Author-Consultant http://www.danshafer.com http://www.shafermedia.com _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Joshua Lanza