Skip to content

Move guardian imports out of compat #6054

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

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

rpkilby
Copy link
Member

@rpkilby rpkilby commented Jun 22, 2018

Supersedes #6038. The check now just ensures guardian is present in the INSTALLED_APPS, without attempting an import. Since this check is called during runtime by the framework, we won't trigger a "Django is not configured" error.

@rpkilby rpkilby added this to the 3.8.3 Release milestone Jun 22, 2018
Copy link
Contributor

@blueyed blueyed left a comment

Choose a reason for hiding this comment

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

Yeah, import rest_framework.serializers now works.

I wonder if we should have some kind of integration test for this, i.e. call python -c 'import rest_framework.serializers' as a tox command, maybe in testenv:dist and a new testenv:dist-base?

except ImportError:
pass
# django-guardian is optional and only imported if in INSTALLED_APPS.
def is_guardian_installed():
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use a __doc__ comment here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@rpkilby ⬆️😉

@carltongibson carltongibson modified the milestones: 3.8.3 Release, 3.9 Release Jul 6, 2018
Copy link
Collaborator

@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.

This is super-duper. Good work!

@carltongibson carltongibson merged commit 9b8af04 into encode:master Jul 6, 2018
@rpkilby rpkilby deleted the guardian-import branch July 6, 2018 14:05
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
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.

4 participants