Code review comment for lp:~adiroiban/launchpad/bug-525371

Revision history for this message
Adi Roiban (adiroiban) wrote :

Hi,

Here is the diff with the changes discussed in the latest comment.

If everything is ok, can you please sent this branch to ec2-test?

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2010-05-19 17:24:21 +0000
+++ lib/lp/registry/model/distroseries.py 2010-06-03 15:06:35 +0000
@@ -1886,7 +1886,7 @@
         """See `IHasTranslationTemplates`."""
         result = POTemplate.selectBy(distroseries=self,
                                      orderBy=['-priority', 'name'])
- return shortlist(result, 2000)
+ return result

     def getCurrentTranslationTemplates(self, just_ids=False):
         """See `IHasTranslationTemplates`."""

=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2010-05-17 09:35:18 +0000
+++ lib/lp/registry/model/productseries.py 2010-06-03 15:06:14 +0000
@@ -427,7 +427,7 @@
         """See `IHasTranslationTemplates`."""
         result = POTemplate.selectBy(
             productseries=self, orderBy=['-priority', 'name'])
- return shortlist(result, 300)
+ return result

     def getCurrentTranslationTemplates(self, just_ids=False):
         """See `IHasTranslationTemplates`."""

=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py 2010-05-17 09:35:18 +0000
+++ lib/lp/registry/model/sourcepackage.py 2010-06-03 15:19:06 +0000
@@ -602,7 +602,7 @@
         result = POTemplate.selectBy(
             distroseries=self.distroseries,
             sourcepackagename=self.sourcepackagename)
- return shortlist(result.orderBy(['-priority', 'name']), 300)
+ return result.orderBy(['-priority', 'name'])

     def getCurrentTranslationTemplates(self, just_ids=False):
         """See `IHasTranslationTemplates`."""

=== modified file 'lib/lp/translations/browser/potemplate.py'
--- lib/lp/translations/browser/potemplate.py 2010-05-27 14:38:56 +0000
+++ lib/lp/translations/browser/potemplate.py 2010-06-03 16:02:24 +0000
@@ -774,18 +774,17 @@

         # Get whether the target for the requested template is officially
         # using Launchpad Translations.
- if potemplate.distribution is not None:
- official_rosetta = potemplate.distribution.official_rosetta
- elif potemplate.product is not None:
- official_rosetta = potemplate.product.official_rosetta
+ if potemplate.distribution is None:
+ product_or_distro = potemplate.productseries.product
         else:
- raise AssertionError('Unknown context for %s' % potemplate.title)
+ product_or_distro = potemplate.distroseries.distribution
+ official_rosetta = product_or_distro.official_rosetta

- if ((official_rosetta and potemplate.iscurrent) or
- check_permission('launchpad.Edit', potemplate)):
- # The target is using officially Launchpad Translations and the
- # template is available to be translated, or the user is a is a
- # Launchpad administrator in which case we show everything.
+ if official_rosetta and potemplate.iscurrent:
+ # This template is available for translation.
+ return potemplate
+ elif check_permission('launchpad.Edit', potemplate):
+ # User has Edit privileges for this template and can access it.
             return potemplate
         else:
             raise NotFoundError(name)

=== modified file 'lib/lp/translations/interfaces/potemplate.py'
--- lib/lp/translations/interfaces/potemplate.py 2010-05-27 14:38:56 +0000
+++ lib/lp/translations/interfaces/potemplate.py 2010-06-03 15:07:23 +0000
@@ -736,7 +736,7 @@
     @export_read_operation()
     @operation_returns_collection_of(IPOTemplate)
     def getTranslationTemplates():
- """Return all translation templates for this entry.
+ """Return an iterator over all its translation templates.

         The returned templates are either obsolete or current.
         """

=== modified file 'lib/lp/translations/model/distroseries_translations_copy.py'
--- lib/lp/translations/model/distroseries_translations_copy.py 2009-07-17 00:26:05 +0000
+++ lib/lp/translations/model/distroseries_translations_copy.py 2010-06-03 13:39:29 +0000
@@ -44,7 +44,7 @@
     copier = MultiTableCopy(full_name, translation_tables, logger=logger)

     # Incremental copy of updates is no longer supported
- assert len(child.getTranslationTemplates()) == 0, (
+ assert child.getTranslationTemplates().is_empty(), (
            "The child series must not yet have any translation templates.")

     logger.info(

« Back to merge proposal