Commit ce82077e authored by Chris McDonough's avatar Chris McDonough

Fix for Collector 823 (XML RPC exception values were always converted

to strings and thus turned into a Fault object).  Thanks to Sandor Palfy
for the patch.
parent 2a46e14d
......@@ -126,8 +126,10 @@ class Response:
# Don't mask 404 respnses, as some XML-RPC libraries rely on the HTTP
# mechanisms for detecting when authentication is required. Fixes Zope
# Collector issue 525.
if t == 'Unauthorized' or (isinstance(t, types.ClassType)
and issubclass(t, Unauthorized)):
if t == 'Unauthorized' or (
isinstance(t, types.ClassType) and issubclass(t, Unauthorized)
):
return self._real.exception(fatal=fatal, info=info)
# Create an appropriate Fault object. Containing error information
......@@ -135,16 +137,16 @@ class Response:
f=None
try:
# Strip HTML tags from the error value
v = str(v)
vstr = str(v)
remove = [r"<[^<>]*>", r"&[A-Za-z]+;"]
for pat in remove:
v = re.sub(pat, " ", v)
vstr = re.sub(pat, " ", vstr)
from Globals import DevelopmentMode
if DevelopmentMode:
from traceback import format_exception
value = '\n' + ''.join(format_exception(t, v, tb))
value = '\n' + ''.join(format_exception(t, vstr, tb))
else:
value = '%s - %s' % (t, v)
value = '%s - %s' % (t, vstr)
if isinstance(v, Fault):
f=v
......
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