Commit 98d3e112 authored by Casey Duncan's avatar Casey Duncan

After further investigation I found that my change to SimpleItem to sniff the...

After further investigation I found that my change to SimpleItem to sniff the response._error_format was unnecessary (although harmless) since Zope/__init__.py already does this. This check has been removed.

And since error logging was being done in SimpleItem, my previous change prevented xml-rpc exceptions from being logged.

The logging code has now been moved into the Zope/__init__ top-level exception handler to correct this problem. This also seems generally more correct since we no longer rely on SimpleItem to do-the-right-thing.
parent 9a5d2b7c
...@@ -17,8 +17,8 @@ Aqueduct database adapters, etc. ...@@ -17,8 +17,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new This module can also be used as a simple template for implementing new
item types. item types.
$Id: SimpleItem.py,v 1.103 2002/08/30 18:29:57 caseman Exp $''' $Id: SimpleItem.py,v 1.104 2002/08/30 19:17:07 caseman Exp $'''
__version__='$Revision: 1.103 $'[11:-2] __version__='$Revision: 1.104 $'[11:-2]
import re, sys, Globals, App.Management, Acquisition, App.Undo import re, sys, Globals, App.Management, Acquisition, App.Undo
import AccessControl.Role, AccessControl.Owned, App.Common import AccessControl.Role, AccessControl.Owned, App.Common
...@@ -156,13 +156,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, ...@@ -156,13 +156,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
elif type(tb) is type('') and not error_tb: elif type(tb) is type('') and not error_tb:
error_tb = tb error_tb = tb
try:
log = aq_acquire(self, '__error_log__', containment=1)
except AttributeError:
error_log_url = ''
else:
error_log_url = log.raising((error_type, error_value, tb))
# turn error_type into a string # turn error_type into a string
if hasattr(error_type, '__name__'): if hasattr(error_type, '__name__'):
error_type=error_type.__name__ error_type=error_type.__name__
...@@ -190,7 +183,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, ...@@ -190,7 +183,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
if client is None: client=self if client is None: client=self
if not REQUEST: REQUEST=self.aq_acquire('REQUEST') if not REQUEST: REQUEST=self.aq_acquire('REQUEST')
if REQUEST.RESPONSE._error_format == 'text/html':
try: try:
if hasattr(client, 'standard_error_message'): if hasattr(client, 'standard_error_message'):
s=getattr(client, 'standard_error_message') s=getattr(client, 'standard_error_message')
...@@ -223,8 +215,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable, ...@@ -223,8 +215,6 @@ class Item(Base, Resource, CopySource, App.Management.Tabs, Traversable,
" (Also, an error occurred while attempting " " (Also, an error occurred while attempting "
"to render the standard error message.)") "to render the standard error message.)")
raise error_type, v, tb raise error_type, v, tb
else:
raise error_type, error_value, tb
finally: finally:
if hasattr(self, '_v_eek'): del self._v_eek if hasattr(self, '_v_eek'): del self._v_eek
tb=None tb=None
......
...@@ -91,6 +91,7 @@ sys.modules['Main']=sys.modules['Zope'] ...@@ -91,6 +91,7 @@ sys.modules['Main']=sys.modules['Zope']
import ZODB.POSException, ZPublisher, ZPublisher import ZODB.POSException, ZPublisher, ZPublisher
import ExtensionClass import ExtensionClass
from zLOG import LOG, WARNING, INFO, BLATHER, log_time from zLOG import LOG, WARNING, INFO, BLATHER, log_time
from Acquisition import aq_acquire
conflict_errors = 0 conflict_errors = 0
startup_time = log_time() startup_time = log_time()
def debug(*args, **kw): def debug(*args, **kw):
...@@ -129,6 +130,13 @@ def zpublisher_exception_hook( ...@@ -129,6 +130,13 @@ def zpublisher_exception_hook(
raise ZPublisher.Retry(t, v, traceback) raise ZPublisher.Retry(t, v, traceback)
if t is ZPublisher.Retry: v.reraise() if t is ZPublisher.Retry: v.reraise()
try:
log = aq_acquire(published, '__error_log__', containment=1)
except AttributeError:
error_log_url = ''
else:
error_log_url = log.raising((t, v, traceback))
if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '')
!='text/html'): raise !='text/html'): raise
......
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