Thanks for the review.
Have no mercy reviewing my branches. It is your project and you should not accept bad code.
Don't worry, I will not take offence.
Here is the latest diff.
=== modified file 'lib/lp/translations/browser/product.py'
--- lib/lp/translations/browser/product.py 2010-01-28 14:23:10 +0000
+++ lib/lp/translations/browser/product.py 2010-01-29 16:08:54 +0000
@@ -116,13 +116,10 @@
"""Return series which are not yet set up for translations.
The list is sorted in alphabetically order and obsolete series
- will be excluded.
+ are excluded.
"""
- all_active_series = set(
- [serie for serie in self.context.series if (
- serie.status != SeriesStatus.OBSOLETE)])
- translatable = set(self.context.translatable_series)
- return sorted(
- all_active_series - translatable,
- key=lambda series: series.name)
+ translatable = self.context.translatable_series
+ return [series for series in self.context.series if (
+ series.status != SeriesStatus.OBSOLETE and
+ series not in translatable)]
- # 'untranslatable_series' is a cached property, this is why we
- # check it after adding all series.
- self.assertTrue(series_experimental in view.untranslatable_series)
- self.assertTrue(series_development in view.untranslatable_series)
- self.assertTrue(series_frozen in view.untranslatable_series)
- self.assertTrue(series_current in view.untranslatable_series)
- self.assertTrue(series_supported in view.untranslatable_series)
- self.assertTrue(series_future in view.untranslatable_series)
-
- # Obsolete series are not included
- self.assertFalse(series_obsolete in view.untranslatable_series)
-
- # Series are listed in alphabetical order, 'evo-current'
- # is firsts, while 'trunk' is last.
- self.assertTrue(
- series_current == view.untranslatable_series[0])
- self.assertTrue(
- series_trunk == view.untranslatable_series[-1])
+ # The series are returned in alphabetical order and do not
+ # include obsolete series.
+ series_names = [series.name for series in view.untranslatable_series]
+ self.assertEqual([
+ u'evo-current',
+ u'evo-development',
+ u'evo-experimental',
+ u'evo-frozen',
+ u'evo-future',
+ u'evo-supported',
+ u'trunk'], series_names)
Hey,
Thanks for the review.
Have no mercy reviewing my branches. It is your project and you should not accept bad code.
Don't worry, I will not take offence.
Here is the latest diff.
=== modified file 'lib/lp/ translations/ browser/ product. py' translations/ browser/ product. py 2010-01-28 14:23:10 +0000 translations/ browser/ product. py 2010-01-29 16:08:54 +0000
--- lib/lp/
+++ lib/lp/
@@ -116,13 +116,10 @@
"""Return series which are not yet set up for translations.
The list is sorted in alphabetically order and obsolete series
- will be excluded.
+ are excluded.
"""
- all_active_series = set( OBSOLETE) ]) context. translatable_ series) translatable_ series OBSOLETE and
- [serie for serie in self.context.series if (
- serie.status != SeriesStatus.
- translatable = set(self.
- return sorted(
- all_active_series - translatable,
- key=lambda series: series.name)
+ translatable = self.context.
+ return [series for series in self.context.series if (
+ series.status != SeriesStatus.
+ series not in translatable)]
=== modified file 'lib/lp/ translations/ browser/ tests/test_ product_ view.py' translations/ browser/ tests/test_ product_ view.py 2010-01-28 14:23:10 +0000 translations/ browser/ tests/test_ product_ view.py 2010-01-29 16:11:36 +0000
--- lib/lp/
+++ lib/lp/
@@ -7,9 +7,9 @@
from canonical. launchpad. webapp. servers import LaunchpadTestRe quest ssLayer interfaces. series import SeriesStatus .browser. product import ProductView interfaces. series import SeriesStatus
from canonical.testing import LaunchpadZopele
+from lp.registry.
from lp.translations
from lp.testing import TestCaseWithFactory
-from lp.registry.
class TestProduct( TestCaseWithFac tory):
@@ -17,9 +17,6 @@
layer = LaunchpadZopele ssLayer
- def setUp(self): tory.setUp( self) translatable_ with_package_ link(self) : makeProduct( )
product= product, name='evo-future')
series_ future. status = SeriesStatus.FUTURE
- TestCaseWithFac
-
def test_primary_
# Create a product that uses translations.
product = self.factory.
@@ -75,24 +72,17 @@
- # 'untranslatable _series' is a cached property, this is why we (series_ experimental in view.untranslat able_series) (series_ development in view.untranslat able_series) (series_ frozen in view.untranslat able_series) (series_ current in view.untranslat able_series) (series_ supported in view.untranslat able_series) (series_ future in view.untranslat able_series) e(series_ obsolete in view.untranslat able_series) able_series[ 0]) able_series[ -1]) able_series] tal',
- # check it after adding all series.
- self.assertTrue
- self.assertTrue
- self.assertTrue
- self.assertTrue
- self.assertTrue
- self.assertTrue
-
- # Obsolete series are not included
- self.assertFals
-
- # Series are listed in alphabetical order, 'evo-current'
- # is firsts, while 'trunk' is last.
- self.assertTrue(
- series_current == view.untranslat
- self.assertTrue(
- series_trunk == view.untranslat
+ # The series are returned in alphabetical order and do not
+ # include obsolete series.
+ series_names = [series.name for series in view.untranslat
+ self.assertEqual([
+ u'evo-current',
+ u'evo-development',
+ u'evo-experimen
+ u'evo-frozen',
+ u'evo-future',
+ u'evo-supported',
+ u'trunk'], series_names)
def test_suite():
=== modified file 'lib/lp/ translations/ stories/ productseries/ xx-productserie s-translations. txt' translations/ stories/ productseries/ xx-productserie s-translations. txt 2010-01-28 14:23:10 +0000 translations/ stories/ productseries/ xx-productserie s-translations. txt 2010-01-29 16:04:34 +0000
--- lib/lp/
+++ lib/lp/
@@ -271,7 +271,7 @@
Setting up translations for series ------- ------- ------- ------- -- ------- ------- ------- -------
-------
+------
When visiting product translations main page, project developers sees
status for current series configured for translations.