← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/question-api-fixes into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/question-api-fixes into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #779924 in Launchpad itself: "IQuestionSet['getByID'] needs its return type set to IQuestion"
  https://bugs.launchpad.net/launchpad/+bug/779924

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/question-api-fixes/+merge/60465

IQuestionSet['getByID'] wasn't properly declaring its return type as IQuestion. This branch fixes that.

No tests, since it's fairly hard to break accidentally, and launchpadlib tests are really slow.
-- 
https://code.launchpad.net/~wgrant/launchpad/question-api-fixes/+merge/60465
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/question-api-fixes into lp:launchpad.
=== modified file 'lib/lp/answers/interfaces/questioncollection.py'
--- lib/lp/answers/interfaces/questioncollection.py	2011-04-26 16:22:11 +0000
+++ lib/lp/answers/interfaces/questioncollection.py	2011-05-10 07:24:37 +0000
@@ -26,6 +26,7 @@
     export_read_operation,
     operation_for_version,
     operation_parameters,
+    operation_returns_entry,
     )
 
 from canonical.launchpad import _
@@ -95,6 +96,7 @@
         question_id=Int(
             title=_('The id of the question to get'),
             required=True))
+    @operation_returns_entry(Interface)
     @export_read_operation()
     @export_operation_as("getByID")
     @operation_for_version('devel')

=== modified file 'lib/lp/answers/interfaces/webservice.py'
--- lib/lp/answers/interfaces/webservice.py	2011-05-06 04:00:41 +0000
+++ lib/lp/answers/interfaces/webservice.py	2011-05-10 07:24:37 +0000
@@ -16,12 +16,11 @@
 
 from lazr.restful.declarations import LAZR_WEBSERVICE_EXPORTED
 
+from canonical.launchpad.components.apihelpers import patch_entry_return_type
 from lp.answers.interfaces.question import IQuestion
 from lp.answers.interfaces.questioncollection import IQuestionSet
-from lp.answers.interfaces.questiontarget import IQuestionTarget
 
 
 IQuestionSet.queryTaggedValue(
     LAZR_WEBSERVICE_EXPORTED)['collection_entry_schema'] = IQuestion
-IQuestionSet['get'].queryTaggedValue(
-    LAZR_WEBSERVICE_EXPORTED)['return_type'] = IQuestion
+patch_entry_return_type(IQuestionSet, 'get', IQuestion)