django-saml2-auth icon indicating copy to clipboard operation
django-saml2-auth copied to clipboard

Catch NoReverseMatch instead of having a bare except

Open kronion opened this issue 7 years ago • 0 comments

A bare except: is generally bad practice because it can lead to unexpected behavior, such as handling KeyboardInterrupt. It is cleaner to be specific about what error conditions this code can handle: failed url lookups, i.e. NoRevereMatch.

Also, Django changed the location of these imports in 1.10. While it was still possible to use the old locations until 2.0, a warning would be logged. The warning is avoided by changing the version this code checks for.

kronion avatar Nov 11 '18 00:11 kronion