Commit 52bf4e55 authored by Jim Fulton's avatar Jim Fulton

Rarranged error handling and fixed up minor bug.

parent f7484c60
"""Document object"""
__version__='$Revision: 1.49 $'[11:-2]
__version__='$Revision: 1.50 $'[11:-2]
from Globals import HTML, HTMLFile, MessageDialog
from string import join,split,strip,rfind,atoi,lower
......@@ -73,34 +73,35 @@ class Document(cDocumentTemplate.cDocument, HTML, Explicit,
""" """
kw['document_id'] =self.id
kw['document_title']=self.title
try: r=apply(HTML.__call__, (self, client, REQUEST), kw)
except:
if self.id()=='standard_error_message':
raise sys.exc_type, sys.exc_value, sys.exc_traceback
error_type=sys.exc_type
error_value=sys.exc_value
if lower(error_type) in ('redirect',):
raise error_type, error_value, sys.exc_traceback
if regex.search('[a-zA-Z]>', error_value) > 0:
error_message=error_value
else:
error_message=''
tb=sys.exc_traceback
error_tb=pretty_tb(error_type, error_value, tb)
if client is not None: c=client
else: c=self.aq_parent
try:
s=getattr(c, 'standard_error_message')
v=HTML.__call__(s, c, REQUEST, error_type=error_type,
error_value=error_value,
error_tb=error_tb, error_traceback=error_tb,
error_message=error_message)
try:
try: r=apply(HTML.__call__, (self, client, REQUEST), kw)
except:
v='Sorry, an error occured'
sys.exc_traceback=tb
tb=None
raise error_type, v, sys.exc_traceback
if self.id()=='standard_error_message':
raise sys.exc_type, sys.exc_value, sys.exc_traceback
error_type=sys.exc_type
error_value=sys.exc_value
tb=sys.exc_traceback
if lower(error_type) in ('redirect',):
raise error_type, error_value, tb
if (type(error_value) is type('') and
regex.search('[a-zA-Z]>', error_value) > 0):
error_message=error_value
else:
error_message=''
error_tb=pretty_tb(error_type, error_value, tb)
if client is not None: c=client
else: c=self.aq_parent
try:
s=getattr(c, 'standard_error_message')
v=HTML.__call__(s, c, REQUEST, error_type=error_type,
error_value=error_value,
error_tb=error_tb, error_traceback=error_tb,
error_message=error_message)
except:
v='Sorry, an error occured'
raise error_type, v, tb
finally: tb=None
if RESPONSE is None: return r
return decapitate(r, RESPONSE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment