Skip to content

Move guardian imports out of compat - #6054

Merged
carltongibson merged 1 commit into
encode:masterfrom
rpkilby:guardian-import
Jul 6, 2018
Merged

carltongibson merged 1 commit into
encode:masterfrom
rpkilby:guardian-import

Conversation

@rpkilby

@rpkilby rpkilby commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

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

@blueyed blueyed left a comment

Copy link
Copy Markdown
Contributor

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?

Comment thread rest_framework/compat.py
except ImportError:
pass
# django-guardian is optional and only imported if in INSTALLED_APPS.
def is_guardian_installed():

Copy link
Copy Markdown
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
Copy Markdown
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

@carltongibson carltongibson left a comment

Copy link
Copy Markdown
Collaborator

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

Development

Successfully merging this pull request may close these issues.

4 participants