summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2018-09-26 08:46:27 -0500
committerJason Madden <jamadden@gmail.com>2018-09-26 08:46:27 -0500
commitb690985c5835dccee75dac171c53d87e83929893 (patch)
tree15313cb84aed46946fd0a101c1dee193c9dc94d5 /src
parenta8bb58e35a3b71e0da4baab8cec5d3e55c054e90 (diff)
downloadzope-configuration-b690985c5835dccee75dac171c53d87e83929893.tar.gz
Be less clever and more explicit, per review.
Diffstat (limited to 'src')
-rw-r--r--src/zope/configuration/xmlconfig.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/zope/configuration/xmlconfig.py b/src/zope/configuration/xmlconfig.py
index 24cdcac..a91cbd6 100644
--- a/src/zope/configuration/xmlconfig.py
+++ b/src/zope/configuration/xmlconfig.py
@@ -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):
@@ -205,9 +201,9 @@ class ConfigurationHandler(ContentHandler):
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]),
@@ -271,9 +267,9 @@ class ConfigurationHandler(ContentHandler):
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]),