[Zope-Checkins] CVS: Releases/Zope/lib/python/Zope - __init__.py:1.28
Evan Simpson
evan@zope.com
Mon, 28 Jan 2002 10:38:20 -0500
Update of /cvs-repository/Releases/Zope/lib/python/Zope
In directory cvs.zope.org:/tmp/cvs-serv9582/Zope
Modified Files:
__init__.py
Log Message:
Fix issubclass() call that fails on string exceptions.
=== Releases/Zope/lib/python/Zope/__init__.py 1.27 => 1.28 ===
# static
StringType=type(''),
- lower=string.lower,
ConflictError=ZODB.POSException.ConflictError,
ListType=type([]),
):
try:
- if ((type(t) is StringType and
- lower(t) in ('unauthorized', 'redirect'))
- or t is SystemExit):
- raise
- if issubclass(t, ConflictError):
- # now what
- # First, we need to close the current connection. We'll
- # do this by releasing the hold on it. There should be
- # some sane protocol for this, but for now we'll use
- # brute force:
- global conflict_errors
- conflict_errors = conflict_errors + 1
- method_name = REQUEST.get('PATH_INFO', '')
- err = ('ZODB conflict error at %s (%s conflicts since startup '
- 'at %s)')
- LOG(err % (method_name, conflict_errors, startup_time), INFO, '')
- LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
- raise ZPublisher.Retry(t, v, traceback)
- if t is ZPublisher.Retry: v.reraise()
+ if isinstance(t, StringType):
+ if t.lower() in ('unauthorized', 'redirect'):
+ raise
+ else:
+ if t is SystemExit:
+ raise
+ if issubclass(t, ConflictError):
+ # First, we need to close the current connection. We'll
+ # do this by releasing the hold on it. There should be
+ # some sane protocol for this, but for now we'll use
+ # brute force:
+ global conflict_errors
+ conflict_errors = conflict_errors + 1
+ method_name = REQUEST.get('PATH_INFO', '')
+ err = ('ZODB conflict error at %s '
+ '(%s conflicts since startup at %s)')
+ LOG(err % (method_name, conflict_errors, startup_time),
+ INFO, '')
+ LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
+ raise ZPublisher.Retry(t, v, traceback)
+ if t is ZPublisher.Retry: v.reraise()
if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '')
!='text/html'): raise