Avoid chained exception messages in the ICU templates

This commit is contained in:
Kovid Goyal 2019-04-02 15:25:09 +05:30
parent cf220e7372
commit bea653d594
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -130,6 +130,7 @@ def {name}(obj):
try:
return {collator}.{func}(obj)
except AttributeError:
pass
return {collator_func}().{func}(obj)
except TypeError:
if isinstance(obj, bytes):
@ -147,6 +148,7 @@ def {name}(a, b):
try:
return {collator}.{func}(a, b)
except AttributeError:
pass
return {collator_func}().{func}(a, b)
except TypeError:
if isinstance(a, bytes):
@ -172,6 +174,7 @@ def {name}(x):
try:
return _icu.change_case(x, _icu.{which}, _locale)
except NotImplementedError:
pass
collator() # sets _locale
return _icu.change_case(x, _icu.{which}, _locale)
except TypeError: