Skip to content

Commit

Permalink
Be less clever and more explicit, per review.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Sep 26, 2018
1 parent a8bb58e commit b690985
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/zope/configuration/xmlconfig.py
Expand Up @@ -162,11 +162,7 @@ class ConfigurationHandler(ContentHandler):

def __init__(self, context, testing=False):
self.context = context
# We use this in an `except:` clause. For backwards
# compatibility, ever though this attribute isn't documented,
# we keep it in an attribute named 'testing' which can be interpreted
# as a boolean
self.testing = BaseException if testing else ()
self.testing = testing
self.ignore_depth = 0

def setDocumentLocator(self, locator):
Expand Down Expand Up @@ -205,9 +201,9 @@ def startElementNS(self, name, qname, attrs):

try:
self.context.begin(name, data, info)
except self.testing:
raise
except Exception:
if self.testing:
raise
reraise(ZopeXMLConfigurationError(info,
sys.exc_info()[0],
sys.exc_info()[1]),
Expand Down Expand Up @@ -271,9 +267,9 @@ def endElementNS(self, name, qname):

try:
self.context.end()
except self.testing:
raise
except Exception:
if self.testing:
raise
reraise(ZopeXMLConfigurationError(info,
sys.exc_info()[0],
sys.exc_info()[1]),
Expand Down

0 comments on commit b690985

Please sign in to comment.