Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch NoReverseMatch instead of having a bare except #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kronion
Copy link

@kronion kronion commented Nov 11, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant