[Zope] using exceptions in python scripts

roymath@yahoo.com roymath@yahoo.com
Wed, 30 Jan 2002 20:58:14 -0500


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.