When I ran that script and read the traceback I found the message: Unauthorized: time Python Scripts run in a "sandbox" with limited import capabilities. There is a way around it somewhere in the docs. Cheers. -- Andy McKay. ----- Original Message ----- From: "Bruce Eckel" <Bruce@EckelObjects.com> To: "password horpz" <zope@zope.org> Cc: <chrism@digicool.com> Sent: Tuesday, May 15, 2001 10:00 AM Subject: [Zope] Weird (?) Python Script problem
The following script follows all the rules, I think. It saves fine, and I usually get an exception when I save a script if there's something wrong with it. But when I try to run it, it pops up the "Please type your user name and password" dialog box, and it will not accept my "root" zope admin password.
## Script (Python) "SeminarID" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=name ##title= ## import string, time
order_id = string.join(string.split(string.strip(name)), '') # Remove spaces idstring = ''
for c in order_id: if c in string.letters: # Take only characters idstring = idstring + c order_id = idstring[0:20] # Take only the first 20 characters order_id = "%s%x" % (order_id, time.time()) # Combine with current time in hex for unique ID return order_id
Most current information can be found at: http://www.mindview.net/Etc/notes.html =================== Bruce Eckel http://www.BruceEckel.com Contains free electronic books: "Thinking in Java 2e" & "Thinking in C++ 2e" Please subscribe to my free newsletter -- just send any email to: join-eckel-oo-programming@earth.lyris.net My schedule can be found at: http://www.mindview.net/Calendar ===================
_______________________________________________ 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 )