Merge lp:~cjwatson/lazr.restful/django-zope-compatibility into lp:lazr.restful

Proposed by Colin Watson on 2018-09-28
Status: Merged
Merged at revision: 220
Proposed branch: lp:~cjwatson/lazr.restful/django-zope-compatibility
Merge into: lp:lazr.restful
Diff against target: 62 lines (+14/-4)
3 files modified
src/lazr/restful/NEWS.txt (+8/-0)
src/lazr/restful/docs/django.txt (+1/-1)
src/lazr/restful/frameworks/django.py (+5/-3)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/django-zope-compatibility
Reviewer Review Type Date Requested Status
William Grant code 2018-09-28 Approve on 2018-10-01
Review via email: mp+355840@code.launchpad.net

Commit message

Fix IDjangoLocation for compatibility with zope.traversing >= 3.13.

Description of the change

This is an API break, but I don't see a good alternative. (I'm also not sure I've ever heard of anyone using this Django support code, so I'm not too worried.)

To post a comment you must log in.
William Grant (wgrant) wrote :

lazr.restful.django was presumably introduced for SSO, which no longer uses lazr.restful.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/lazr/restful/NEWS.txt'
--- src/lazr/restful/NEWS.txt 2018-02-21 15:18:34 +0000
+++ src/lazr/restful/NEWS.txt 2018-09-28 14:30:01 +0000
@@ -2,6 +2,14 @@
2NEWS for lazr.restful2NEWS for lazr.restful
3=====================3=====================
44
50.21.0
6======
7
8Fix IDjangoLocation for compatibility with zope.traversing >= 3.13, which
9only adapts objects to ILocation if they do not have a __parent__ attribute.
10Objects implementing IDjangoLocation must now have a __parent_object__
11attribute instead of __parent__.
12
50.20.1 (2018-02-21)130.20.1 (2018-02-21)
6===================14===================
715
816
=== modified file 'src/lazr/restful/docs/django.txt'
--- src/lazr/restful/docs/django.txt 2016-02-17 01:07:21 +0000
+++ src/lazr/restful/docs/django.txt 2018-09-28 14:30:01 +0000
@@ -151,7 +151,7 @@
151 ... class SubordinateResource:151 ... class SubordinateResource:
152 ...152 ...
153 ... @property153 ... @property
154 ... def __parent__(self):154 ... def __parent_object__(self):
155 ... return DummyRootResource()155 ... return DummyRootResource()
156 ...156 ...
157 ... @property157 ... @property
158158
=== modified file 'src/lazr/restful/frameworks/django.py'
--- src/lazr/restful/frameworks/django.py 2016-02-17 01:07:21 +0000
+++ src/lazr/restful/frameworks/django.py 2018-09-28 14:30:01 +0000
@@ -65,13 +65,15 @@
6565
66 The problem with ILocation is that you have to define __name__,66 The problem with ILocation is that you have to define __name__,
67 and the Django metaclass won't let you assign a property to67 and the Django metaclass won't let you assign a property to
68 __name__.68 __name__. We also can't use __parent__ here, because that will
69 confuse AbsoluteURL into thinking that this can be treated as an
70 ILocation.
69 """71 """
7072
71 def __url_path__(self):73 def __url_path__(self):
72 """The URL path for this object."""74 """The URL path for this object."""
7375
74 def __parent__(self):76 def __parent_object__(self):
75 """This object's parent in the object tree."""77 """This object's parent in the object tree."""
7678
77# We want a raised django.core.exceptions.ObjectDoesNotExist79# We want a raised django.core.exceptions.ObjectDoesNotExist
@@ -102,7 +104,7 @@
102104
103 @property105 @property
104 def __parent__(self):106 def __parent__(self):
105 return self.context.__parent__107 return self.context.__parent_object__
106108
107 @property109 @property
108 def __name__(self):110 def __name__(self):

Subscribers

People subscribed via source and target branches