Merge lp:~leonardr/lazr.restful/exported-subclass into lp:lazr.restful

Proposed by Leonard Richardson
Status: Merged
Approved by: Eleanor Berger
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~leonardr/lazr.restful/exported-subclass
Merge into: lp:lazr.restful
Diff against target: 86 lines (+21/-4)
6 files modified
src/lazr/restful/NEWS.txt (+5/-0)
src/lazr/restful/_resource.py (+2/-2)
src/lazr/restful/declarations.py (+1/-0)
src/lazr/restful/example/base/interfaces.py (+11/-0)
src/lazr/restful/metazcml.py (+1/-1)
src/lazr/restful/version.txt (+1/-1)
To merge this branch: bzr merge lp:~leonardr/lazr.restful/exported-subclass
Reviewer Review Type Date Requested Status
Eleanor Berger (community) Approve
Review via email: mp+19337@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote :

Ignore the title; it has nothing to do with what this branch is actually about. This branch contains fixes for miscellaneous bugs I found while integrating multiversion lazr.restful into Launchpad.

The "list(versions)" code fixes a failure that happens when you run lazr.restful under Python 2.5 (as Launchpad does). The incoming list of versions is a tuple object, and tuple objects don't implement index() until 2.6.

The change to metazcml.py fixes a failure that happens when you publish both an interface and a subclass of that interface. The superclass and subclass both publish the same Method object as a named operation, which was causing a ZCML conflict. I changed the ZCML discriminator to include the interface object, making it possible for two classes to publish the same method. I added a subclass of ICookbook to the example web service to test this.

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve

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 2010-02-11 17:57:16 +0000
3+++ src/lazr/restful/NEWS.txt 2010-02-15 14:59:15 +0000
4@@ -2,6 +2,11 @@
5 NEWS for lazr.restful
6 =====================
7
8+0.9.19 (2010-02-15)
9+===================
10+
11+A few minor bugfixes to help with Launchpad integration.
12+
13 0.9.18 (2010-02-11)
14 ===================
15
16
17=== modified file 'src/lazr/restful/_resource.py'
18--- src/lazr/restful/_resource.py 2010-02-11 17:57:16 +0000
19+++ src/lazr/restful/_resource.py 2010-02-15 14:59:15 +0000
20@@ -1838,10 +1838,10 @@
21 and registration.required[1].providedBy(request))]
22 assert not len(entry_classes) > 1, (
23 "%s provides more than one IEntry subclass for version %s." %
24- entry_interface.__name__, request.version)
25+ (entry_interface.__name__, request.version))
26 assert not len(entry_classes) < 1, (
27 "%s does not provide any IEntry subclass for version %s." %
28- entry_interface.__name__, request.version)
29+ (entry_interface.__name__, request.version))
30 return EntryAdapterUtility(entry_classes[0])
31
32 def __init__(self, entry_class):
33
34=== modified file 'src/lazr/restful/declarations.py'
35--- src/lazr/restful/declarations.py 2010-02-08 16:28:13 +0000
36+++ src/lazr/restful/declarations.py 2010-02-15 14:59:15 +0000
37@@ -847,6 +847,7 @@
38 """
39
40 _check_tagged_interface(interface, 'entry')
41+ versions = list(versions)
42
43 # First off, make sure any given version defines only one
44 # destructor method.
45
46=== modified file 'src/lazr/restful/example/base/interfaces.py'
47--- src/lazr/restful/example/base/interfaces.py 2009-09-01 12:07:59 +0000
48+++ src/lazr/restful/example/base/interfaces.py 2010-02-15 14:59:15 +0000
49@@ -161,6 +161,17 @@
50 IDish['recipes'].value_type.schema = IRecipe
51 IRecipe['cookbook'].schema = ICookbook
52
53+
54+class ICookbookSubclass(ICookbook):
55+ """A published subclass of ICookbook.
56+
57+ This entry interface is never used, but it acts as a test case for
58+ a published entry interface that subclasses another published
59+ entry interface.
60+ """
61+ export_as_webservice_entry()
62+
63+
64 class IFeaturedCookbookLink(ITopLevelEntryLink):
65 """A marker interface."""
66
67
68=== modified file 'src/lazr/restful/metazcml.py'
69--- src/lazr/restful/metazcml.py 2010-02-11 17:57:16 +0000
70+++ src/lazr/restful/metazcml.py 2010-02-15 14:59:15 +0000
71@@ -219,7 +219,7 @@
72 # First, make sure that this method was annotated with the
73 # versions in the right order.
74 context.action(
75- discriminator=('webservice version ordering', method),
76+ discriminator=('webservice version ordering', interface, method),
77 callable=ensure_correct_version_ordering,
78 args=(interface.__name__ + '.' + method.__name__, tag.dict_names)
79 )
80
81=== modified file 'src/lazr/restful/version.txt'
82--- src/lazr/restful/version.txt 2010-02-10 17:04:38 +0000
83+++ src/lazr/restful/version.txt 2010-02-15 14:59:15 +0000
84@@ -1,1 +1,1 @@
85-0.9.18
86+0.9.19

Subscribers

People subscribed via source and target branches