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
=== modified file 'src/lazr/restful/NEWS.txt'
--- src/lazr/restful/NEWS.txt 2010-02-11 17:57:16 +0000
+++ src/lazr/restful/NEWS.txt 2010-02-15 14:59:15 +0000
@@ -2,6 +2,11 @@
2NEWS for lazr.restful2NEWS for lazr.restful
3=====================3=====================
44
50.9.19 (2010-02-15)
6===================
7
8A few minor bugfixes to help with Launchpad integration.
9
50.9.18 (2010-02-11)100.9.18 (2010-02-11)
6===================11===================
712
813
=== modified file 'src/lazr/restful/_resource.py'
--- src/lazr/restful/_resource.py 2010-02-11 17:57:16 +0000
+++ src/lazr/restful/_resource.py 2010-02-15 14:59:15 +0000
@@ -1838,10 +1838,10 @@
1838 and registration.required[1].providedBy(request))]1838 and registration.required[1].providedBy(request))]
1839 assert not len(entry_classes) > 1, (1839 assert not len(entry_classes) > 1, (
1840 "%s provides more than one IEntry subclass for version %s." %1840 "%s provides more than one IEntry subclass for version %s." %
1841 entry_interface.__name__, request.version)1841 (entry_interface.__name__, request.version))
1842 assert not len(entry_classes) < 1, (1842 assert not len(entry_classes) < 1, (
1843 "%s does not provide any IEntry subclass for version %s." %1843 "%s does not provide any IEntry subclass for version %s." %
1844 entry_interface.__name__, request.version)1844 (entry_interface.__name__, request.version))
1845 return EntryAdapterUtility(entry_classes[0])1845 return EntryAdapterUtility(entry_classes[0])
18461846
1847 def __init__(self, entry_class):1847 def __init__(self, entry_class):
18481848
=== modified file 'src/lazr/restful/declarations.py'
--- src/lazr/restful/declarations.py 2010-02-08 16:28:13 +0000
+++ src/lazr/restful/declarations.py 2010-02-15 14:59:15 +0000
@@ -847,6 +847,7 @@
847 """847 """
848848
849 _check_tagged_interface(interface, 'entry')849 _check_tagged_interface(interface, 'entry')
850 versions = list(versions)
850851
851 # First off, make sure any given version defines only one852 # First off, make sure any given version defines only one
852 # destructor method.853 # destructor method.
853854
=== modified file 'src/lazr/restful/example/base/interfaces.py'
--- src/lazr/restful/example/base/interfaces.py 2009-09-01 12:07:59 +0000
+++ src/lazr/restful/example/base/interfaces.py 2010-02-15 14:59:15 +0000
@@ -161,6 +161,17 @@
161IDish['recipes'].value_type.schema = IRecipe161IDish['recipes'].value_type.schema = IRecipe
162IRecipe['cookbook'].schema = ICookbook162IRecipe['cookbook'].schema = ICookbook
163163
164
165class ICookbookSubclass(ICookbook):
166 """A published subclass of ICookbook.
167
168 This entry interface is never used, but it acts as a test case for
169 a published entry interface that subclasses another published
170 entry interface.
171 """
172 export_as_webservice_entry()
173
174
164class IFeaturedCookbookLink(ITopLevelEntryLink):175class IFeaturedCookbookLink(ITopLevelEntryLink):
165 """A marker interface."""176 """A marker interface."""
166177
167178
=== modified file 'src/lazr/restful/metazcml.py'
--- src/lazr/restful/metazcml.py 2010-02-11 17:57:16 +0000
+++ src/lazr/restful/metazcml.py 2010-02-15 14:59:15 +0000
@@ -219,7 +219,7 @@
219 # First, make sure that this method was annotated with the219 # First, make sure that this method was annotated with the
220 # versions in the right order.220 # versions in the right order.
221 context.action(221 context.action(
222 discriminator=('webservice version ordering', method),222 discriminator=('webservice version ordering', interface, method),
223 callable=ensure_correct_version_ordering,223 callable=ensure_correct_version_ordering,
224 args=(interface.__name__ + '.' + method.__name__, tag.dict_names)224 args=(interface.__name__ + '.' + method.__name__, tag.dict_names)
225 )225 )
226226
=== modified file 'src/lazr/restful/version.txt'
--- src/lazr/restful/version.txt 2010-02-10 17:04:38 +0000
+++ src/lazr/restful/version.txt 2010-02-15 14:59:15 +0000
@@ -1,1 +1,1 @@
10.9.1810.9.19

Subscribers

People subscribed via source and target branches