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

Remove unused DjangoContext creation #433

Merged
merged 1 commit into from
Jun 26, 2023
Merged

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jun 22, 2023

It was not used at all. If we ever need this code back (only if the plugin is updated to support new features, while I don't use drf anymore and do not plan to work on this), we can use this compat code:

        plugin_config = DjangoPluginConfig(options.config_file)

        # XXX: this is a compat code for older `DjangoContext` API.
        try:
            # First, we try the old signature. The new API would fail with `RuntimeError`.
            # While, the old one would just work
            self.django_context = DjangoContext(plugin_config.django_settings_module)
        except RuntimeError:
            # New API:
            self.django_context = DjangoContext(plugin_config)

I've also updated typeddjango/django-stubs#1557 to have all the compat code we need.

Closes #432

Copy link
Contributor

@intgr intgr left a comment

Choose a reason for hiding this comment

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

Thanks!

@sobolevn sobolevn merged commit 7a3c9c5 into master Jun 26, 2023
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.

Change how we use DjangoContext after https://github.com/typeddjango/django-stubs/pull/1557
2 participants