Skip to content

Commit

Permalink
Remove support for string exceptions.
Browse files Browse the repository at this point in the history
They have been removed in Python 2.6. In case of a string raised, it will end up as a `InvalidErrorTypeExpression`.
  • Loading branch information
sallner committed Oct 3, 2018
1 parent 5422662 commit ae8dba3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Changelog

- Added support for Python 3.7.

- Remove support for string exceptions in ``<dtml-except>``.


3.0b4 (2018-07-12)
------------------

Expand Down
11 changes: 1 addition & 10 deletions src/DocumentTemplate/DT_Try.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ def render_try_except(self, md):
except Exception:
# but an error occurs.. save the info.
t, v = sys.exc_info()[:2]
if isinstance(t, str):
errname = t
else:
errname = t.__name__
errname = t.__name__

handler = self.find_handler(t)

Expand Down Expand Up @@ -196,12 +193,6 @@ def render_try_finally(self, md):

def find_handler(self, exception):
"recursively search for a handler for a given exception"
if isinstance(exception, str):
for e, h in self.handlers:
if exception == e or e == '':
return h
else:
return None
for e, h in self.handlers:
if (e == exception.__name__ or
e == '' or self.match_base(exception, e)):
Expand Down

0 comments on commit ae8dba3

Please sign in to comment.