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

Prevent circular ImportError hiding for rest_framework sub-package #741

Merged
merged 2 commits into from
Aug 31, 2017

Conversation

rpkilby
Copy link
Collaborator

@rpkilby rpkilby commented Jun 21, 2017

The try/catch block doesn't discriminate the origin of import errors. While it's intended to no-op when DRF isn't installed, it also hides circular import errors, leading to a cryptic "NoneType has no attribute..." exception instead of the original import error.

Copy link
Owner

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. I like this. I just need to read up on it. 😃

@carltongibson carltongibson added this to the Version 1.1 milestone Aug 31, 2017
Copy link
Owner

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great.

I just added the ...is not None since I wasn't familiar with find_loader, and it's a little clearer for me this way.

@carltongibson carltongibson merged commit cbc566a into carltongibson:develop Aug 31, 2017
@rpkilby rpkilby deleted the drf-import branch August 31, 2017 08:02
carltongibson pushed a commit that referenced this pull request Oct 19, 2017
)

* Prevent ImportError hiding for rest_framework sub-package

* Prefer explicit boolean
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.

2 participants