# 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.
"""
# 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.")
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/distroser ies.py' registry/ model/distroser ies.py 2010-05-19 17:24:21 +0000 registry/ model/distroser ies.py 2010-06-03 15:06:35 +0000 nTemplates` .""" selectBy( distroseries= self,
orderBy= ['-priority' , 'name'])
--- lib/lp/
+++ lib/lp/
@@ -1886,7 +1886,7 @@
"""See `IHasTranslatio
result = POTemplate.
- return shortlist(result, 2000)
+ return result
def getCurrentTrans lationTemplates (self, just_ids=False): nTemplates` ."""
"""See `IHasTranslatio
=== modified file 'lib/lp/ registry/ model/productse ries.py' registry/ model/productse ries.py 2010-05-17 09:35:18 +0000 registry/ model/productse ries.py 2010-06-03 15:06:14 +0000 nTemplates` .""" selectBy(
productse ries=self, orderBy= ['-priority' , 'name'])
--- lib/lp/
+++ lib/lp/
@@ -427,7 +427,7 @@
"""See `IHasTranslatio
result = POTemplate.
- return shortlist(result, 300)
+ return result
def getCurrentTrans lationTemplates (self, just_ids=False): nTemplates` ."""
"""See `IHasTranslatio
=== modified file 'lib/lp/ registry/ model/sourcepac kage.py' registry/ model/sourcepac kage.py 2010-05-17 09:35:18 +0000 registry/ model/sourcepac kage.py 2010-06-03 15:19:06 +0000 selectBy(
distroser ies=self. distroseries,
sourcepac kagename= self.sourcepack agename) result. orderBy( ['-priority' , 'name']), 300) orderBy( ['-priority' , 'name'])
--- lib/lp/
+++ lib/lp/
@@ -602,7 +602,7 @@
result = POTemplate.
- return shortlist(
+ return result.
def getCurrentTrans lationTemplates (self, just_ids=False): nTemplates` ."""
"""See `IHasTranslatio
=== modified file 'lib/lp/ translations/ browser/ potemplate. py' translations/ browser/ potemplate. py 2010-05-27 14:38:56 +0000 translations/ browser/ potemplate. py 2010-06-03 16:02:24 +0000
--- lib/lp/
+++ lib/lp/
@@ -774,18 +774,17 @@
# Get whether the target for the requested template is officially distribution is not None: distribution. official_ rosetta product. official_ rosetta distribution is None: productseries. product 'Unknown context for %s' % potemplate.title) distroseries. distribution or_distro. official_ rosetta
# using Launchpad Translations.
- if potemplate.
- official_rosetta = potemplate.
- elif potemplate.product is not None:
- official_rosetta = potemplate.
+ if potemplate.
+ product_or_distro = potemplate.
else:
- raise AssertionError(
+ product_or_distro = potemplate.
+ official_rosetta = product_
- if ((official_rosetta and potemplate. iscurrent) or n('launchpad. Edit', potemplate)): iscurrent: n('launchpad. Edit', potemplate):
- check_permissio
- # 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.
+ # This template is available for translation.
+ return potemplate
+ elif check_permissio
+ # 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' translations/ interfaces/ potemplate. py 2010-05-27 14:38:56 +0000 translations/ interfaces/ potemplate. py 2010-06-03 15:07:23 +0000 read_operation( ) _returns_ collection_ of(IPOTemplate) emplates( ):
--- lib/lp/
+++ lib/lp/
@@ -736,7 +736,7 @@
@export_
@operation
def getTranslationT
- """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/distroser ies_translation s_copy. py' translations/ model/distroser ies_translation s_copy. py 2009-07-17 00:26:05 +0000 translations/ model/distroser ies_translation s_copy. py 2010-06-03 13:39:29 +0000 full_name, translation_tables, logger=logger)
--- lib/lp/
+++ lib/lp/
@@ -44,7 +44,7 @@
copier = MultiTableCopy(
# Incremental copy of updates is no longer supported getTranslationT emplates( )) == 0, ( ationTemplates( ).is_empty( ), (
- assert len(child.
+ assert child.getTransl
"The child series must not yet have any translation templates.")
logger.info(