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

Proposed by Colin Watson
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 Approve
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.
Revision history for this message
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
1=== modified file 'src/lazr/restful/NEWS.txt'
2--- src/lazr/restful/NEWS.txt 2018-02-21 15:18:34 +0000
3+++ src/lazr/restful/NEWS.txt 2018-09-28 14:30:01 +0000
4@@ -2,6 +2,14 @@
5 NEWS for lazr.restful
6 =====================
7
8+0.21.0
9+======
10+
11+Fix IDjangoLocation for compatibility with zope.traversing >= 3.13, which
12+only adapts objects to ILocation if they do not have a __parent__ attribute.
13+Objects implementing IDjangoLocation must now have a __parent_object__
14+attribute instead of __parent__.
15+
16 0.20.1 (2018-02-21)
17 ===================
18
19
20=== modified file 'src/lazr/restful/docs/django.txt'
21--- src/lazr/restful/docs/django.txt 2016-02-17 01:07:21 +0000
22+++ src/lazr/restful/docs/django.txt 2018-09-28 14:30:01 +0000
23@@ -151,7 +151,7 @@
24 ... class SubordinateResource:
25 ...
26 ... @property
27- ... def __parent__(self):
28+ ... def __parent_object__(self):
29 ... return DummyRootResource()
30 ...
31 ... @property
32
33=== modified file 'src/lazr/restful/frameworks/django.py'
34--- src/lazr/restful/frameworks/django.py 2016-02-17 01:07:21 +0000
35+++ src/lazr/restful/frameworks/django.py 2018-09-28 14:30:01 +0000
36@@ -65,13 +65,15 @@
37
38 The problem with ILocation is that you have to define __name__,
39 and the Django metaclass won't let you assign a property to
40- __name__.
41+ __name__. We also can't use __parent__ here, because that will
42+ confuse AbsoluteURL into thinking that this can be treated as an
43+ ILocation.
44 """
45
46 def __url_path__(self):
47 """The URL path for this object."""
48
49- def __parent__(self):
50+ def __parent_object__(self):
51 """This object's parent in the object tree."""
52
53 # We want a raised django.core.exceptions.ObjectDoesNotExist
54@@ -102,7 +104,7 @@
55
56 @property
57 def __parent__(self):
58- return self.context.__parent__
59+ return self.context.__parent_object__
60
61 @property
62 def __name__(self):

Subscribers

People subscribed via source and target branches