Merge ~cjwatson/lazr.restful:remove-relative-import-hack into lazr.restful:main

Proposed by Colin Watson
Status: Merged
Merged at revision: 067f6c697543a1df20f3718646719bd269a658b1
Proposed branch: ~cjwatson/lazr.restful:remove-relative-import-hack
Merge into: lazr.restful:main
Diff against target: 21 lines (+2/-8)
1 file modified
src/lazr/restful/frameworks/django.py (+2/-8)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+413799@code.launchpad.net

Commit message

Remove relative import hack from lazr.restful.frameworks.django

Description of the change

It's no longer needed on Python 3, since that always uses absolute imports.

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

Looks good

Just curious - why do we not install Django for testing? Whenever Django decides to restructure its hiearachy / API, our tests will continue to pass, but the code will no longer work.

Who is using the Django integration?

review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

SSO used it at one point (as indicated by https://bugs.launchpad.net/lazr.restful/+bug/640132), but no longer does. I'm afraid I have no idea who, if anyone, is using the Django integration at this point. This all long predates me, and since I don't really know its history or usage I've been hesitant to touch it more than necessary.

I've filed https://bugs.launchpad.net/lazr.restful/+bug/1956782 to consider removing this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/lazr/restful/frameworks/django.py b/src/lazr/restful/frameworks/django.py
index a7ae447..c3f9a85 100644
--- a/src/lazr/restful/frameworks/django.py
+++ b/src/lazr/restful/frameworks/django.py
@@ -20,14 +20,8 @@ from zope.schema import getFieldsInOrder
20from zope.traversing.browser.absoluteurl import AbsoluteURL20from zope.traversing.browser.absoluteurl import AbsoluteURL
2121
22import grokcore.component22import grokcore.component
2323from django.core.exceptions import ObjectDoesNotExist
24# Without this trickery, this module (called "django") will mask the24from django.db.models.manager import Manager
25# real Django modules. We could use "from __future__ import
26# absolute_import", but that would not work with Python 2.4.
27ObjectDoesNotExist = __import__(
28 "django.core.exceptions", {}
29).core.exceptions.ObjectDoesNotExist
30Manager = __import__("django.db.models.manager", {}).db.models.manager.Manager
3125
32from lazr.restful import directives # noqa: E40226from lazr.restful import directives # noqa: E402
33from lazr.restful.interfaces import ( # noqa: E40227from lazr.restful.interfaces import ( # noqa: E402

Subscribers

People subscribed via source and target branches