Dear Zope Users, Fairly new to Zope, but I am writing a Python Script. I would like to use exceptions in my processing flow, but the security restrictions won't allow it. What is the recommended approach here? For example, what I would like to do, but am not allowed to, is: # sample_py ---------------------------------------- request = container.REQUEST RESPONSE = request.RESPONSE try: username = request.get("username", None) if len(username)==0: raise "ZeroLengthUserName", None except: import sys # SECURITY won't allow print sys.exc_type; return printed # process username here... # return another dtml document/method return context.registered_ok_dtml(context,context.REQUEST) # end sample_py ---------------------------------------- Thanks, Roy Mathew. ps: please respond directly to me as well, if you could.
roy@anoobe.com wrote:
Dear Zope Users,
Fairly new to Zope, but I am writing a Python Script. I would like to use exceptions in my processing flow, but the security restrictions won't allow it. What is the recommended approach here?
For example, what I would like to do, but am not allowed to, is:
[schnipp]
except: import sys # SECURITY won't allow print sys.exc_type; return printed
One solution would be to use an external method. But maybe there is a better way. I never used exceptions in python scripts up to now. thomas
Dear Zope Users,
Fairly new to Zope, but I am writing a Python Script. I would like to use exceptions in my processing flow, but the security restrictions won't allow it. What is the recommended approach here?
<snip sample> Roy, recently had this problem and found that I needed to use a (very minimal) product to allow imports into python scripts. I think I already posted it to this list asking people if they saw any problems. I got no response, so I presume nobody saw anything terribly bad. So, here it is again, only with a couple more comments... ----Begin customImports/__init__.py---- from Products.PythonScripts.Utility import allow_module, allow_class from AccessControl import ModuleSecurityInfo, ClassSecurityInfo from Globals import InitializeClass allow_module('exceptions') # Don't think you need this in fact allow_module('traceback') # See below ModuleSecurityInfo('sys').declarePublic('exc_info') #Probably only need the line below instead of allowing the whole 'traceback' module #ModuleSecurityInfo('traceback').declarePublic('extract_tb') ----End __init__.py---- That's it. Put this file in a folder with whatever name you fancy (I chose customImports) in your Products directory and restart zope. hth tim
hi, we are plannning to build a large shopsystem based on the zope framework. we plan to have more parallel shops ... do you know a shop system that comes with this mall functionality ? TIA ~t .. . . . . . . . . weigl interservice thorsten weigl
fon +49-89-510 99 310 mobil +170-480 77 05 mail t.weigl@weigl.de
On Fri, 1 Feb 2002 09:37, Thorsten Weigl wrote:
we are plannning to build a large shopsystem based on the zope framework. we plan to have more parallel shops ... do you know a shop system that comes with this mall functionality ?
Have you looked at Bizar Shop? http://www.bizarsoftware.com.au/ Talk to them about your mall requirements - they're nice guys :) Richard disclaimer: I worked with Bizar
participants (5)
-
Richard Jones -
roy@anoobe.com -
Thomas Guettler -
Thorsten Weigl -
Tim Hicks