Commit d6db71a7 authored by Evan Simpson's avatar Evan Simpson

Fix issubclass() call that fails on string exceptions.

parent 3edf498b
......@@ -99,17 +99,17 @@ def zpublisher_exception_hook(
published, REQUEST, t, v, traceback,
# 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):
if isinstance(t, StringType):
if t.lower() in ('unauthorized', 'redirect'):
raise
else:
if 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
......@@ -117,9 +117,10 @@ def zpublisher_exception_hook(
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, '')
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()
......
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