Commit 1eae46f4 authored by Chris Withers's avatar Chris Withers

- change to use python logging module

- log at error when standard_error_message can't be rendered
- give more useful info about errors rendering standard_error_message to the browser.
parent 8bfcdd41
...@@ -32,12 +32,12 @@ from AccessControl.Permissions import view as View ...@@ -32,12 +32,12 @@ from AccessControl.Permissions import view as View
from AccessControl.ZopeSecurityPolicy import getRoles from AccessControl.ZopeSecurityPolicy import getRoles
from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire
from ComputedAttribute import ComputedAttribute from ComputedAttribute import ComputedAttribute
from DocumentTemplate.html_quote import html_quote
from DocumentTemplate.ustr import ustr from DocumentTemplate.ustr import ustr
from ExtensionClass import Base from ExtensionClass import Base
from webdav.Resource import Resource from webdav.Resource import Resource
from zExceptions import Redirect from zExceptions import Redirect
from zExceptions.ExceptionFormatter import format_exception from zExceptions.ExceptionFormatter import format_exception
from zLOG import LOG, BLATHER
from zope.interface import implements from zope.interface import implements
import ZDOM import ZDOM
...@@ -49,6 +49,8 @@ from Traversable import Traversable ...@@ -49,6 +49,8 @@ from Traversable import Traversable
HTML=Globals.HTML HTML=Globals.HTML
import logging
logger = logging.getLogger()
class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
ZDOM.Element, ZDOM.Element,
...@@ -226,17 +228,21 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, ...@@ -226,17 +228,21 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
else: else:
v = HTML.__call__(s, client, REQUEST, **kwargs) v = HTML.__call__(s, client, REQUEST, **kwargs)
except: except:
LOG('OFS', BLATHER, logger.error(
'Exception while rendering an error message', 'Exception while rendering an error message',
error=sys.exc_info()) exc_info=True
)
try: try:
strv = str(error_value) strv = str(error_value)
except: except:
strv = ('<unprintable %s object>' % strv = ('<unprintable %s object>' %
str(type(error_value).__name__)) str(type(error_value).__name__))
v = strv + ( v = strv + (
" (Also, an error occurred while attempting " (" (Also, the following error occurred while attempting "
"to render the standard error message.)") "to render the standard error message, please see the "
"event log for full details: %s)")%(
html_quote(sys.exc_info()[1]),
))
raise error_type, v, tb raise error_type, v, tb
finally: finally:
if hasattr(self, '_v_eek'): del self._v_eek if hasattr(self, '_v_eek'): del self._v_eek
......
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