django-saml2-auth
django-saml2-auth copied to clipboard
Catch NoReverseMatch instead of having a bare except
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.