[Zope-Checkins] CVS: Zope/lib/python/OFS - SimpleItem.py:1.104
Casey Duncan
casey@zope.com
Fri, 30 Aug 2002 15:17:08 -0400
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv8242/OFS
Modified Files:
SimpleItem.py
Log Message:
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.
=== Zope/lib/python/OFS/SimpleItem.py 1.103 => 1.104 ===
--- Zope/lib/python/OFS/SimpleItem.py:1.103 Fri Aug 30 14:29:57 2002
+++ Zope/lib/python/OFS/SimpleItem.py Fri Aug 30 15:17:07 2002
@@ -156,13 +156,6 @@
elif type(tb) is type('') and not error_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
if hasattr(error_type, '__name__'):
error_type=error_type.__name__
@@ -190,41 +183,38 @@
if client is None: client=self
if not REQUEST: REQUEST=self.aq_acquire('REQUEST')
- if REQUEST.RESPONSE._error_format == 'text/html':
+ try:
+ if hasattr(client, 'standard_error_message'):
+ s=getattr(client, 'standard_error_message')
+ else:
+ client = client.aq_parent
+ s=getattr(client, 'standard_error_message')
+ kwargs = {'error_type': error_type,
+ 'error_value': error_value,
+ 'error_tb': error_tb,
+ 'error_traceback': error_tb,
+ 'error_message': error_message,
+ 'error_log_url': error_log_url}
+
+ if isinstance(s, HTML):
+ v = s(client, REQUEST, **kwargs)
+ elif callable(s):
+ v = s(**kwargs)
+ else:
+ v = HTML.__call__(s, client, REQUEST, **kwargs)
+ except:
+ LOG('OFS', BLATHER,
+ 'Exception while rendering an error message',
+ error=sys.exc_info())
try:
- if hasattr(client, 'standard_error_message'):
- s=getattr(client, 'standard_error_message')
- else:
- client = client.aq_parent
- s=getattr(client, 'standard_error_message')
- kwargs = {'error_type': error_type,
- 'error_value': error_value,
- 'error_tb': error_tb,
- 'error_traceback': error_tb,
- 'error_message': error_message,
- 'error_log_url': error_log_url}
-
- if isinstance(s, HTML):
- v = s(client, REQUEST, **kwargs)
- elif callable(s):
- v = s(**kwargs)
- else:
- v = HTML.__call__(s, client, REQUEST, **kwargs)
+ strv = str(error_value)
except:
- LOG('OFS', BLATHER,
- 'Exception while rendering an error message',
- error=sys.exc_info())
- try:
- strv = str(error_value)
- except:
- strv = ('<unprintable %s object>' %
- str(type(error_value).__name__))
- v = strv + (
- " (Also, an error occurred while attempting "
- "to render the standard error message.)")
- raise error_type, v, tb
- else:
- raise error_type, error_value, tb
+ strv = ('<unprintable %s object>' %
+ str(type(error_value).__name__))
+ v = strv + (
+ " (Also, an error occurred while attempting "
+ "to render the standard error message.)")
+ raise error_type, v, tb
finally:
if hasattr(self, '_v_eek'): del self._v_eek
tb=None