← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/fix-translationgroup-export into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/fix-translationgroup-export into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #732157 in Launchpad itself: "launchpad.translation_groups not exported over Web Service correctly"
  https://bugs.launchpad.net/launchpad/+bug/732157

For more details, see:
https://code.launchpad.net/~abentley/launchpad/fix-translationgroup-export/+merge/56748

= Summary =
Fix bug #732157: launchpad.translation_groups not exported over Web Service correctly

== Proposed fix ==
Instead of returning the TranslationGroupSet, return a ResultSet.

== Pre-implementation notes ==
None

== Implementation details ==
None

== Tests ==
bin/test -t test_list_groups test_translationgroup

== Demo and Q/A ==
Using launchpadlib, create a Launchpad object and do list(launchpad.translation_groups).  It should not blow up, and should give accurate results.


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/translations/model/translationgroup.py
  lib/lp/translations/tests/test_translationgroup.py
-- 
https://code.launchpad.net/~abentley/launchpad/fix-translationgroup-export/+merge/56748
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/fix-translationgroup-export into lp:launchpad.
=== modified file 'lib/lp/translations/model/translationgroup.py'
--- lib/lp/translations/model/translationgroup.py	2011-03-07 19:05:44 +0000
+++ lib/lp/translations/model/translationgroup.py	2011-04-07 12:28:55 +0000
@@ -36,6 +36,7 @@
     LibraryFileContent,
     )
 from canonical.launchpad.interfaces.lpstorm import (
+    IStore,
     ISlaveStore,
     )
 from lp.app.errors import NotFoundError
@@ -293,7 +294,7 @@
             raise NotFoundError(name)
 
     def _get(self):
-        return self
+        return IStore(TranslationGroup).find(TranslationGroup)
 
     def new(self, name, title, summary, translation_guide_url, owner):
         """See ITranslationGroupSet."""

=== modified file 'lib/lp/translations/tests/test_translationgroup.py'
--- lib/lp/translations/tests/test_translationgroup.py	2011-03-04 21:15:00 +0000
+++ lib/lp/translations/tests/test_translationgroup.py	2011-04-07 12:28:55 +0000
@@ -88,6 +88,13 @@
         e = self.assertRaises(Unauthorized, ws_group.lp_save)
         self.assertIn("'name', 'launchpad.Edit'", str(e))
 
+    def test_list_groups(self):
+        """Listing translation groups works and is accurate."""
+        translation_group_set = getUtility(ITranslationGroupSet)
+        self.assertContentEqual(
+            [group.name for group in translation_group_set],
+            [group.name for group in self.service.translation_groups])
+
 
 def test_suite():
     return TestLoader().loadTestsFromName(__name__)