launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02683
[Merge] lp:~abentley/launchpad/pomessage-sequence into lp:launchpad
Aaron Bentley has proposed merging lp:~abentley/launchpad/pomessage-sequence into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~abentley/launchpad/pomessage-sequence/+merge/50344
= Summary =
A sequence number of 0 is a special value that means a POTMsgSet is obsolete, and so most tests that create POTMsgSets want a non-zero value. We should make that the default behaviour.
== Proposed fix ==
Use getUniqueInteger so that we get a non-zero sequence number.
== Pre-implementation notes ==
== Implementation details ==
Most tests that specify sequence=1 will work fine with any non-zero sequence number, and so they are changed to use the default sequence number instead.
A few tests that specify sequence=1 actually want 1 specifically, and those are retained.
Some tests create a POTMsgSet and then immediately set the sequence number. Those are changed to either specify the sequence in makePOTMsgSet, or accept the default, as above.
== Tests ==
bin/test -v
== Demo and Q/A ==
None
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/translations/tests/test_translations_to_review.py
lib/lp/translations/tests/test_clearcurrenttranslation.py
lib/lp/translations/tests/test_translationmerger.py
lib/lp/translations/tests/test_pofile.py
lib/lp/translations/tests/test_autoapproval.py
lib/lp/translations/tests/test_translationmessage.py
lib/lp/testing/factory.py
lib/lp/translations/tests/test_potmsgset.py
lib/lp/translations/tests/test_shared_potemplate.py
lib/lp/translations/tests/test_setcurrenttranslation.py
lib/lp/translations/tests/test_translationmergejob.py
lib/lp/translations/tests/test_helpers.py
lib/lp/translations/tests/test_translatablemessage.py
lib/lp/translations/tests/test_side.py
lib/lp/translations/tests/test_suggestions.py
./lib/lp/translations/tests/test_setcurrenttranslation.py
131: E301 expected 1 blank line, found 2
--
https://code.launchpad.net/~abentley/launchpad/pomessage-sequence/+merge/50344
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/pomessage-sequence into lp:launchpad.
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2011-02-16 11:18:48 +0000
+++ lib/lp/testing/factory.py 2011-02-18 15:15:35 +0000
@@ -2721,10 +2721,12 @@
create_sharing=create_sharing)
def makePOTMsgSet(self, potemplate, singular=None, plural=None,
- context=None, sequence=0):
+ context=None, sequence=None):
"""Make a new `POTMsgSet` in the given template."""
if singular is None and plural is None:
singular = self.getUniqueString()
+ if sequence is None:
+ sequence = self.getUniqueInteger()
potmsgset = potemplate.createMessageSetFromText(
singular, plural, context, sequence)
removeSecurityProxy(potmsgset).sync()
@@ -2769,7 +2771,7 @@
if pofile is None:
pofile = self.makePOFile('sr')
if potmsgset is None:
- potmsgset = self.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.makePOTMsgSet(pofile.potemplate)
if translator is None:
translator = self.makePerson()
translations = self.makeTranslationsDict(translations)
@@ -2827,7 +2829,7 @@
if pofile is None:
pofile = self.makePOFile(language=language, side=side)
if potmsgset is None:
- potmsgset = self.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.makePOTMsgSet(pofile.potemplate)
if translator is None:
translator = self.makePerson()
if reviewer is None:
=== modified file 'lib/lp/translations/tests/test_autoapproval.py'
--- lib/lp/translations/tests/test_autoapproval.py 2011-01-24 15:51:18 +0000
+++ lib/lp/translations/tests/test_autoapproval.py 2011-02-18 15:15:35 +0000
@@ -787,7 +787,7 @@
template = self.factory.makePOTemplate(
productseries=trunk, translation_domain='domain')
template.iscurrent = True
- self.factory.makePOTMsgSet(template, "translator-credits", sequence=1)
+ self.factory.makePOTMsgSet(template, "translator-credits")
entry = self.queue.addOrUpdateEntry(
'nl.po', '# ...', False, template.owner, productseries=trunk)
@@ -1055,7 +1055,7 @@
trunk = self.product.getSeries('trunk')
template = self._makeTemplate(trunk)
credits = self.factory.makePOTMsgSet(
- template, singular='translation-credits', sequence=1)
+ template, singular='translation-credits')
entry = self._makeQueueEntry(trunk)
=== modified file 'lib/lp/translations/tests/test_clearcurrenttranslation.py'
--- lib/lp/translations/tests/test_clearcurrenttranslation.py 2010-08-24 11:39:06 +0000
+++ lib/lp/translations/tests/test_clearcurrenttranslation.py 2011-02-18 15:15:35 +0000
@@ -80,7 +80,7 @@
# will create an empty message so as to mark the review time.
pofile = self._makePOFile()
template = pofile.potemplate
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
potmsgset.clearCurrentTranslation(pofile, template.owner, ORIGIN)
@@ -94,7 +94,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
tm = self._makeTranslationMessage(potmsgset, pofile)
traits.setFlag(tm, True)
self.assertTrue(traits.getFlag(tm))
@@ -107,7 +107,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
tm = self._makeTranslationMessage(potmsgset, pofile, diverged=True)
traits.setFlag(tm, True)
@@ -122,7 +122,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
shared_tm = self._makeTranslationMessage(potmsgset, pofile)
traits.setFlag(shared_tm, True)
diverged_tm = self._makeTranslationMessage(
@@ -145,7 +145,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
tm = self._makeTranslationMessage(potmsgset, pofile)
traits.setFlag(tm, True)
@@ -162,7 +162,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
tm = self._makeTranslationMessage(potmsgset, pofile)
traits.setFlag(tm, True)
traits.other_side_traits.setFlag(tm, True)
@@ -176,7 +176,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
tm = self._makeTranslationMessage(potmsgset, pofile)
traits.setFlag(tm, True)
traits.other_side_traits.setFlag(tm, True)
@@ -191,7 +191,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
diverged_tm = self._makeTranslationMessage(
potmsgset, pofile, diverged=True)
traits.setFlag(diverged_tm, True)
@@ -211,7 +211,7 @@
# review fields set.
pofile = self._makePOFile()
template = pofile.potemplate
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
reviewer = self.factory.makePerson()
potmsgset.clearCurrentTranslation(pofile, reviewer, ORIGIN)
@@ -229,7 +229,7 @@
pofile = self._makePOFile()
template = pofile.potemplate
traits = get_traits(template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
blank = self.factory.makeSuggestion(
potmsgset=potmsgset, pofile=pofile, translations=[])
=== modified file 'lib/lp/translations/tests/test_helpers.py'
--- lib/lp/translations/tests/test_helpers.py 2010-08-23 08:41:03 +0000
+++ lib/lp/translations/tests/test_helpers.py 2011-02-18 15:15:35 +0000
@@ -28,8 +28,7 @@
distroseries=new_series,
sourcepackagename=sourcepackagename)
self.pofile = self.factory.makePOFile('sr', potemplate=potemplate)
- self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=potemplate, sequence=1)
+ self.potmsgset = self.factory.makePOTMsgSet(potemplate=potemplate)
# A POFile in a different context from self.pofile.
self.other_pofile = self.factory.makePOFile(
=== modified file 'lib/lp/translations/tests/test_pofile.py'
--- lib/lp/translations/tests/test_pofile.py 2011-01-20 21:09:28 +0000
+++ lib/lp/translations/tests/test_pofile.py 2011-02-18 15:15:35 +0000
@@ -87,7 +87,7 @@
# The POTMsgSet is added to only one of the POTemplates.
self.potmsgset = self.factory.makePOTMsgSet(
- self.devel_potemplate, sequence=1)
+ self.devel_potemplate)
def test_getPOTMsgSetWithNewSuggestions_shared(self):
# Test listing of suggestions for POTMsgSets with a shared
@@ -248,7 +248,7 @@
# The POTMsgSet is added to only one of the POTemplates.
self.potmsgset = self.factory.makePOTMsgSet(
- self.devel_potemplate, sequence=1)
+ self.devel_potemplate)
def test_POFile_canonical_url(self):
# Test the canonical_url of the POFile.
@@ -266,8 +266,7 @@
# Searching for English strings.
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
- u"Some wild text")
- potmsgset.setSequence(self.devel_potemplate, 2)
+ u"Some wild text", sequence=2)
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"wild"))
@@ -283,8 +282,8 @@
# Searching for singular in plural messages works as well.
plural_potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
u"Some singular text",
- u"Some plural text")
- plural_potmsgset.setSequence(self.devel_potemplate, 3)
+ u"Some plural text",
+ sequence=3)
found_potmsgsets = list(
self.devel_pofile.findPOTMsgSetsContaining(u"singular"))
@@ -480,6 +479,7 @@
def test_getPOTMsgSetTranslated_Multiple(self):
# Test listing of translated POTMsgSets if there is more than one
# translated message.
+ self.potmsgset.setSequence(self.devel_potemplate, 1)
# Add a diverged translation on the included POTMsgSet...
self.factory.makeCurrentTranslationMessage(
@@ -488,8 +488,7 @@
# and a shared translation on newly added POTMsgSet...
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
- u"Translated text")
- potmsgset.setSequence(self.devel_potemplate, 2)
+ u"Translated text", sequence=2)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=potmsgset,
@@ -589,6 +588,7 @@
def test_getPOTMsgSetUntranslated_Multiple(self):
# Test listing of untranslated POTMsgSets if there is more than one
# untranslated message.
+ self.potmsgset.setSequence(self.devel_potemplate, 1)
# Add an empty translation to the included POTMsgSet...
self.factory.makeCurrentTranslationMessage(
@@ -597,8 +597,7 @@
# ...and a new untranslated POTMsgSet.
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
- u"Translated text")
- potmsgset.setSequence(self.devel_potemplate, 2)
+ u"Translated text", sequence=2)
# Both POTMsgSets are listed.
found_translations = list(
@@ -625,6 +624,7 @@
def test_getPOTMsgSetWithNewSuggestions_multiple(self):
# Test that multiple unreviewed POTMsgSets are returned.
+ self.potmsgset.setSequence(self.devel_potemplate, 1)
# One POTMsgSet has no translations, but only a suggestion.
self.factory.makeSuggestion(
@@ -633,8 +633,8 @@
# Another POTMsgSet has both a translation and a suggestion.
potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
- u"Translated text")
- potmsgset.setSequence(self.devel_potemplate, 2)
+ u"Translated text",
+ sequence=2)
date_created = datetime.now(pytz.UTC) - timedelta(5)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=self.potmsgset,
@@ -774,15 +774,15 @@
# First POTMsgSet (self.potmsgset) is untranslated.
# Second POTMsgSet is untranslated, but with a suggestion.
- potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- potmsgset.setSequence(self.devel_potemplate, 2)
+ potmsgset = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=2)
self.factory.makeSuggestion(
pofile=self.devel_pofile, potmsgset=potmsgset,
translations=[u"Unreviewed suggestion"])
# Third POTMsgSet is translated, and with a suggestion.
- potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- potmsgset.setSequence(self.devel_potemplate, 3)
+ potmsgset = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=3)
update_date = datetime.now(pytz.UTC) - timedelta(1)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=potmsgset,
@@ -793,15 +793,15 @@
translations=[u"Another suggestion"])
# Fourth POTMsgSet is translated in import.
- potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- potmsgset.setSequence(self.devel_potemplate, 4)
+ potmsgset = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=4)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=potmsgset,
translations=[u"Imported translation"], current_other=True)
# Fifth POTMsgSet is translated in import, but changed in Ubuntu.
- potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- potmsgset.setSequence(self.devel_potemplate, 5)
+ potmsgset = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=5)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=potmsgset,
translations=[u"Imported translation"], current_other=True)
@@ -810,8 +810,8 @@
translations=[u"LP translation"], current_other=False)
# Sixth POTMsgSet is translated in LP only.
- potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- potmsgset.setSequence(self.devel_potemplate, 6)
+ potmsgset = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=6)
self.factory.makeCurrentTranslationMessage(
pofile=self.devel_pofile, potmsgset=potmsgset,
translations=[u"New translation"], current_other=False)
@@ -1013,7 +1013,7 @@
self.potemplate = self.pofile.potemplate
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.potemplate, sequence=1)
+ potemplate=self.potemplate)
self.credits_potmsgset = self.factory.makePOTMsgSet(
potemplate=self.potemplate, singular=u'translator-credits')
@@ -1189,10 +1189,10 @@
# Create two POTMsgSets that can be used to test in what order
# are they returned. Add them only to devel_potemplate sequentially.
- self.potmsgset1 = self.factory.makePOTMsgSet(self.devel_potemplate)
- self.potmsgset1.setSequence(self.devel_potemplate, 1)
- self.potmsgset2 = self.factory.makePOTMsgSet(self.devel_potemplate)
- self.potmsgset2.setSequence(self.devel_potemplate, 2)
+ self.potmsgset1 = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=1)
+ self.potmsgset2 = self.factory.makePOTMsgSet(
+ self.devel_potemplate, sequence=2)
def test_getPOTMsgSetTranslated_ordering(self):
# Translate both POTMsgSets in devel_pofile, so
@@ -1551,7 +1551,7 @@
# returned along with relevant POTMsgSets.
potemplate1 = self.factory.makePOTemplate()
self.factory.makePOTMsgSet(
- potemplate1, singular=u'translator-credits', sequence=1)
+ potemplate1, singular=u'translator-credits')
sr_pofile = self.factory.makePOFile('sr', potemplate=potemplate1)
self.assertIn(sr_pofile,
@@ -1572,7 +1572,7 @@
potemplate2 = self.factory.makePOTemplate()
self.factory.makePOTMsgSet(
potemplate2, singular=u'Your names',
- context=u'NAME OF TRANSLATORS', sequence=1)
+ context=u'NAME OF TRANSLATORS')
sr_kde_pofile = self.factory.makePOFile('sr', potemplate=potemplate2)
self.assertIn(sr_kde_pofile,
list_of_tuples_into_list(
@@ -1600,7 +1600,7 @@
potemplate = self.factory.makePOTemplate()
credits_potmsgset = self.factory.makePOTMsgSet(
- potemplate, singular=u'translator-credits', sequence=1)
+ potemplate, singular=u'translator-credits')
pofile = self.factory.makePOFile(potemplate=potemplate)
credits_translation = credits_potmsgset.getCurrentTranslation(
@@ -1747,8 +1747,7 @@
# Create a single POTMsgSet that is used across all tests,
# and add it to only one of the POTemplates.
- self.potmsgset = self.factory.makePOTMsgSet(self.potemplate,
- sequence=1)
+ self.potmsgset = self.factory.makePOTMsgSet(self.potemplate)
def test_POFile_updateStatistics_currentCount(self):
# Make sure count of translations which are active both
@@ -1849,7 +1848,7 @@
def test_makeTranslatableMessage(self):
# TranslatableMessages can be created from the PO file
- potmsgset = self.factory.makePOTMsgSet(self.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(self.potemplate)
message = self.pofile.makeTranslatableMessage(potmsgset)
verifyObject(ITranslatableMessage, message)
@@ -2113,7 +2112,7 @@
self.pofile = self.factory.makePOFile('eo')
self.potemplate = self.pofile.potemplate
self.potmsgset = self.factory.makePOTMsgSet(
- self.potemplate, sequence=1)
+ self.potemplate)
def test_getTranslationMessages_current_shared(self):
# A shared message is included in this POFile's messages.
@@ -2241,7 +2240,7 @@
def _makePOFileWithPlural(self, language_code):
pofile = removeSecurityProxy(self.factory.makePOFile(language_code))
self.factory.makePOTMsgSet(
- pofile.potemplate, singular=u"Foo", plural=u"Bar", sequence=1)
+ pofile.potemplate, singular=u"Foo", plural=u"Bar")
return pofile
def test_header_pluralform_equal(self):
@@ -2550,7 +2549,7 @@
def test_translatedCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(0, self.getTranslatedCount(pofile))
@@ -2590,7 +2589,7 @@
# A shared current translation that is masked by a diverged one
# is not counted.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
self.factory.makeDivergedTranslationMessage(
@@ -2601,7 +2600,7 @@
def test_untranslatedCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(1, self.getUntranslatedCount(pofile))
@@ -2643,7 +2642,7 @@
# A shared current translation that is masked by a diverged one
# is only subtracted from the untranslatedCount once.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
self.factory.makeDivergedTranslationMessage(
@@ -2657,7 +2656,7 @@
def test_currentCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(0, self.getCurrentCount(pofile))
@@ -2692,7 +2691,7 @@
# A message that is translated differently in Ubuntu than
# upstream is not included in currentCount.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self._makeOtherSideTranslation(pofile, potmsgset=potmsgset)
this_translation = self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
@@ -2703,7 +2702,7 @@
# Diverging from a translation that's shared between Ubuntu and
# upstream decrements the currentCount.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset, current_other=True)
self.factory.makeDivergedTranslationMessage(
@@ -2717,7 +2716,7 @@
def test_rosettaCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(0, self.getRosettaCount(pofile))
@@ -2766,7 +2765,7 @@
# The rosettaCount does include messages that are translated
# differently on the two sides.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self._makeOtherSideTranslation(pofile, potmsgset=potmsgset)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
@@ -2779,7 +2778,7 @@
def test_updatesCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(0, self.getUpdatesCount(pofile))
@@ -2787,7 +2786,7 @@
# The updatesCount counts messages that are translated on the
# other side, but differently.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self._makeOtherSideTranslation(pofile, potmsgset=potmsgset)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
@@ -2807,7 +2806,7 @@
def test_updatesCount_diverged(self):
# Diverged messages can be part of the updatesCount.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset, current_other=True)
self.factory.makeDivergedTranslationMessage(
@@ -2829,7 +2828,7 @@
def test_unreviewedCount_potmsgset_initial(self):
pofile = self.makePOFile()
- self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ self.factory.makePOTMsgSet(pofile.potemplate)
self.exerciseFunction(pofile)
self.assertEqual(0, self.getUnreviewedCount(pofile))
@@ -2853,7 +2852,7 @@
# The unreviewedCount counts messages with unreviewed
# suggestions, not the suggestions themselves.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
self.factory.makeSuggestion(pofile=pofile, potmsgset=potmsgset)
self.factory.makeSuggestion(pofile=pofile, potmsgset=potmsgset)
self.exerciseFunction(pofile)
@@ -2863,7 +2862,7 @@
# In order to affect the unreviewedCount, a suggestion has to be
# newer than the review date on the current translation.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
suggestion = self.factory.makeSuggestion(
pofile=pofile, potmsgset=potmsgset)
translation = self.factory.makeCurrentTranslationMessage(
@@ -2875,7 +2874,7 @@
# Suggestions that are newer than the review date om the current
# translation are included in the unreviewedCount.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
translation = self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
translation.date_reviewed -= timedelta(1)
@@ -2889,7 +2888,7 @@
# date on the current translation on this side also counts as an
# unreviewed suggestion on this side.
pofile = self.makePOFile()
- potmsgset = self.factory.makePOTMsgSet(pofile.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(pofile.potemplate)
this_translation = self.factory.makeCurrentTranslationMessage(
pofile=pofile, potmsgset=potmsgset)
this_translation.date_reviewed -= timedelta(1)
=== modified file 'lib/lp/translations/tests/test_potmsgset.py'
--- lib/lp/translations/tests/test_potmsgset.py 2011-02-17 14:16:17 +0000
+++ lib/lp/translations/tests/test_potmsgset.py 2011-02-18 15:15:35 +0000
@@ -69,7 +69,7 @@
# Create a single POTMsgSet that is used across all tests,
# and add it to only one of the POTemplates.
self.potmsgset = self.factory.makePOTMsgSet(
- self.devel_potemplate, sequence=1)
+ self.devel_potemplate)
def _refreshSuggestiveTemplatesCache(self):
"""Refresh the `SuggestivePOTemplate` cache."""
@@ -351,8 +351,7 @@
product = external_template.productseries.product
product.translations_usage = ServiceUsage.LAUNCHPAD
external_potmsgset = self.factory.makePOTMsgSet(
- external_template, singular=self.potmsgset.singular_text,
- sequence=1)
+ external_template, singular=self.potmsgset.singular_text)
external_pofile = self.factory.makePOFile(
potemplate=external_template)
language = external_pofile.language
@@ -409,8 +408,7 @@
product = external_template.productseries.product
product.translations_usage = ServiceUsage.LAUNCHPAD
external_potmsgset = self.factory.makePOTMsgSet(
- external_template, singular=self.potmsgset.singular_text,
- sequence=1)
+ external_template, singular=self.potmsgset.singular_text)
external_pofile = self.factory.makePOFile(
potemplate=external_template)
language = external_pofile.language
@@ -631,8 +629,7 @@
self.potemplate = self.factory.makePOTemplate(
productseries=self.foo_main, name="messages")
- self.potmsgset = self.factory.makePOTMsgSet(self.potemplate,
- sequence=1)
+ self.potmsgset = self.factory.makePOTMsgSet(self.potemplate)
self.pofile = self.factory.makePOFile('eo', self.potemplate)
# Set up some translation messages with dummy timestamps that will be
# changed in the tests.
@@ -830,7 +827,7 @@
template = self.potemplate = self.factory.makePOTemplate(
productseries=self.foo_main, name="messages")
- self.potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ self.potmsgset = self.factory.makePOTMsgSet(template)
self.pofile = self.factory.makePOFile('eo', template)
def test_resetCurrentTranslation_shared(self):
@@ -960,8 +957,7 @@
"""
potemplate = self.factory.makePOTemplate(productseries=productseries)
potemplate.source_file_format = format
- potmsgset = self.factory.makePOTMsgSet(
- potemplate, msgid_text, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(potemplate, msgid_text)
return (potmsgset, potemplate)
def _makePOTMsgSet(self, msgid_text, format, productseries=None):
@@ -1101,7 +1097,7 @@
sr_pofile = self.factory.makePOFile('sr', potemplate=self.potemplate)
credits = self.factory.makePOTMsgSet(
- self.potemplate, u'translator-credits', sequence=1)
+ self.potemplate, u'translator-credits')
eo_translation = credits.getCurrentTranslation(
self.potemplate, eo_pofile.language,
@@ -1120,7 +1116,7 @@
# Normal messages do not receive a dummy translation.
eo_pofile = self.factory.makePOFile('eo', potemplate=self.potemplate)
- potmsgset = self.factory.makePOTMsgSet(self.potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(self.potemplate)
eo_translation = potmsgset.getCurrentTranslation(
self.potemplate, eo_pofile.language,
self.potemplate.translation_side)
@@ -1133,7 +1129,7 @@
imported_credits = u'Imported credits.'
credits = self.factory.makePOTMsgSet(
- self.potemplate, u'translator-credits', sequence=1)
+ self.potemplate, u'translator-credits')
self.factory.makeCurrentTranslationMessage(
eo_pofile, credits, translations=[imported_credits],
current_other=True)
@@ -1149,7 +1145,7 @@
# all translation credits messages.
credits = self.factory.makePOTMsgSet(
- self.potemplate, u'translator-credits', sequence=1)
+ self.potemplate, u'translator-credits')
eo_pofile = self.factory.makePOFile('eo', potemplate=self.potemplate)
eo_translation = credits.getCurrentTranslation(
@@ -1727,7 +1723,7 @@
# If there is no current translation, _checkForConflict accepts
# that as conflict-free.
potemplate = self.factory.makePOTemplate()
- potmsgset = self.factory.makePOTMsgSet(potemplate, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(potemplate)
old = datetime.now(pytz.UTC) - timedelta(days=366)
removeSecurityProxy(potmsgset)._checkForConflict(None, old)
=== modified file 'lib/lp/translations/tests/test_setcurrenttranslation.py'
--- lib/lp/translations/tests/test_setcurrenttranslation.py 2011-02-15 10:28:29 +0000
+++ lib/lp/translations/tests/test_setcurrenttranslation.py 2011-02-18 15:15:35 +0000
@@ -1161,7 +1161,7 @@
language_code=self.pofile.language.code)
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=potemplate, sequence=1)
+ potemplate=potemplate)
def selectUpstreamTranslation(self, tm, tm_other):
# See `SetCurrentTranslationTestMixin`
@@ -1201,7 +1201,7 @@
language_code=self.pofile.language.code)
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=potemplate, sequence=1)
+ potemplate=potemplate)
def selectUpstreamTranslation(self, tm, tm_other):
# See `SetCurrentTranslationTestMixin`
=== modified file 'lib/lp/translations/tests/test_shared_potemplate.py'
--- lib/lp/translations/tests/test_shared_potemplate.py 2011-02-14 17:14:17 +0000
+++ lib/lp/translations/tests/test_shared_potemplate.py 2011-02-18 15:15:35 +0000
@@ -44,7 +44,6 @@
# Create a single POTMsgSet that is used across all tests,
# and add it to only one of the POTemplates.
self.potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate)
- self.potmsgset.setSequence(self.devel_potemplate, 1)
def test_getPOTMsgSets(self):
self.potmsgset.setSequence(self.stable_potemplate, 1)
@@ -116,8 +115,8 @@
# Let's add a POTMsgSet with plural forms.
plural_potmsgset = self.factory.makePOTMsgSet(self.devel_potemplate,
singular="singular",
- plural="plural")
- plural_potmsgset.setSequence(self.devel_potemplate, 4)
+ plural="plural",
+ sequence=4)
# Now, template contains a plural form message.
self.assertEquals(self.devel_potemplate.hasPluralMessage(), True)
@@ -662,7 +661,7 @@
distroseries=self.hoary)
self.trunk.setPackaging(self.hoary, self.packagename, self.owner)
hoary_potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.hoary_template, sequence=1)
+ potemplate=self.hoary_template)
trunk_potmsgset = self.trunk_template.getOrCreateSharedPOTMsgSet(
singular_text=hoary_potmsgset.singular_text,
@@ -676,7 +675,7 @@
self.packagename, self.hoary)
sourcepackage.setPackaging(self.trunk, self.owner)
trunk_potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.trunk_template, sequence=1)
+ potemplate=self.trunk_template)
hoary_potmsgset = self.trunk_template.getOrCreateSharedPOTMsgSet(
singular_text=trunk_potmsgset.singular_text,
=== modified file 'lib/lp/translations/tests/test_side.py'
--- lib/lp/translations/tests/test_side.py 2010-09-01 11:35:47 +0000
+++ lib/lp/translations/tests/test_side.py 2011-02-18 15:15:35 +0000
@@ -85,7 +85,7 @@
"""
template = self._makeTemplate()
pofile = self.factory.makePOFile('nl', template)
- potmsgset = self.factory.makePOTMsgSet(template, sequence=1)
+ potmsgset = self.factory.makePOTMsgSet(template)
translationmessage = potmsgset.submitSuggestion(
pofile, self.factory.makePerson(),
{0: self.factory.getUniqueString()})
=== modified file 'lib/lp/translations/tests/test_suggestions.py'
--- lib/lp/translations/tests/test_suggestions.py 2010-12-31 15:39:19 +0000
+++ lib/lp/translations/tests/test_suggestions.py 2011-02-18 15:15:35 +0000
@@ -19,10 +19,6 @@
from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.testing import TestCaseWithFactory
from lp.translations.interfaces.potemplate import IPOTemplateSet
-from lp.translations.interfaces.translationmessage import (
- TranslationValidationStatus,
- )
-from lp.translations.utilities.validate import GettextValidationError
class TestTranslationSuggestions(TestCaseWithFactory):
@@ -63,7 +59,6 @@
# translations for it, there are no suggestions for translating
# it whatsoever.
potmsgset = self.factory.makePOTMsgSet(self.foo_template)
- potmsgset.setSequence(self.foo_template, 1)
self.assertEquals(
potmsgset.getExternallyUsedTranslationMessages(self.nl), [])
self.assertEquals(
@@ -75,9 +70,7 @@
# suggestion.
text = "error message 936"
foomsg = self.factory.makePOTMsgSet(self.foo_template, text)
- foomsg.setSequence(self.foo_template, 1)
barmsg = self.factory.makePOTMsgSet(self.bar_template, text)
- barmsg.setSequence(self.bar_template, 1)
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.bar_nl, current_other=False, potmsgset=barmsg)
@@ -98,9 +91,7 @@
# If global suggestions are disabled, empty list is returned.
text = "error message 936"
foomsg = self.factory.makePOTMsgSet(self.foo_template, text)
- foomsg.setSequence(self.foo_template, 1)
barmsg = self.factory.makePOTMsgSet(self.bar_template, text)
- barmsg.setSequence(self.bar_template, 1)
translation = self.factory.makeCurrentTranslationMessage(
pofile=self.bar_nl, current_other=False, potmsgset=barmsg)
@@ -127,11 +118,9 @@
# Suggestions made for bar can also be useful suggestions for foo.
text = "Welcome to our application! We hope to have code soon."
foomsg = self.factory.makePOTMsgSet(self.foo_template, text)
- foomsg.setSequence(self.foo_template, 1)
barmsg = self.factory.makePOTMsgSet(self.bar_template, text)
- barmsg.setSequence(self.bar_template, 1)
suggestion = barmsg.submitSuggestion(
- self.bar_nl, self.foo_template.owner, { 0: "Noueh hallo dus." })
+ self.bar_nl, self.foo_template.owner, {0: "Noueh hallo dus."})
transaction.commit()
@@ -151,15 +140,13 @@
before = now - timedelta(1, 1, 1)
foomsg = self.factory.makePOTMsgSet(self.foo_template, text)
- foomsg.setSequence(self.foo_template, 1)
barmsg = self.factory.makePOTMsgSet(self.bar_template, text)
- barmsg.setSequence(self.bar_template, 1)
suggestion1 = self.factory.makeCurrentTranslationMessage(
pofile=self.bar_nl, potmsgset=foomsg,
- translations={ 0: suggested_dutch })
+ translations={0: suggested_dutch})
suggestion2 = self.factory.makeCurrentTranslationMessage(
pofile=self.bar_nl, potmsgset=barmsg,
- translations={ 0: suggested_dutch })
+ translations={0: suggested_dutch})
self.assertNotEqual(suggestion1, suggestion2)
removeSecurityProxy(suggestion1).date_created = before
removeSecurityProxy(suggestion2).date_created = before
@@ -170,7 +157,6 @@
oof_template = self.factory.makePOTemplate()
oof_potmsgset = self.factory.makePOTMsgSet(
oof_template, singular=text)
- oof_potmsgset.setSequence(oof_template, 1)
from storm.store import Store
Store.of(oof_template).flush()
transaction.commit()
@@ -188,11 +174,11 @@
potmsgset = self.factory.makePOTMsgSet(self.foo_template)
suggestion1 = self.factory.makeCurrentTranslationMessage(
pofile=self.foo_nl, potmsgset=potmsgset,
- translations={ 0 : translated_in_ubuntu },
+ translations={0: translated_in_ubuntu},
current_other=False)
suggestion2 = self.factory.makeCurrentTranslationMessage(
pofile=self.foo_nl, potmsgset=potmsgset,
- translations={ 0 : translated_upstream },
+ translations={0: translated_upstream},
current_other=True)
ubuntu_translation = potmsgset.getCurrentTranslation(
self.foo_template, self.foo_nl.language,
=== modified file 'lib/lp/translations/tests/test_translatablemessage.py'
--- lib/lp/translations/tests/test_translatablemessage.py 2010-12-16 13:25:54 +0000
+++ lib/lp/translations/tests/test_translatablemessage.py 2011-02-18 15:15:35 +0000
@@ -39,7 +39,7 @@
self.potemplate = self.factory.makePOTemplate(
productseries=self.trunk)
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.potemplate, sequence=1)
+ potemplate=self.potemplate)
self.pofile = self.factory.makePOFile(
potemplate=self.potemplate, language_code='eo')
@@ -76,6 +76,7 @@
def test_sequence(self):
# After instantiation, the sequence number from the potmsgset is
# available.
+ self.potmsgset.setSequence(self.potemplate, 1)
message = TranslatableMessage(self.potmsgset, self.pofile)
self.assertEqual(1, message.sequence)
@@ -156,7 +157,7 @@
product.translations_usage = ServiceUsage.LAUNCHPAD
self.external_potmsgset = self.factory.makePOTMsgSet(
potemplate=self.external_potemplate,
- singular=common_msgid, sequence=1)
+ singular=common_msgid)
self.external_pofile = self.factory.makePOFile(
potemplate=self.external_potemplate, language_code='eo')
=== modified file 'lib/lp/translations/tests/test_translationmergejob.py'
--- lib/lp/translations/tests/test_translationmergejob.py 2011-02-11 20:48:57 +0000
+++ lib/lp/translations/tests/test_translationmergejob.py 2011-02-18 15:15:35 +0000
@@ -28,7 +28,7 @@
upstream_pofile = factory.makePOFile(
side=TranslationSide.UPSTREAM)
upstream_potmsgset = factory.makePOTMsgSet(
- upstream_pofile.potemplate, singular, sequence=1)
+ upstream_pofile.potemplate, singular)
upstream = factory.makeCurrentTranslationMessage(
pofile=upstream_pofile, potmsgset=upstream_potmsgset)
ubuntu_potemplate = factory.makePOTemplate(
@@ -36,7 +36,7 @@
ubuntu_pofile = factory.makePOFile(
potemplate=ubuntu_potemplate, language=upstream_pofile.language)
ubuntu_potmsgset = factory.makePOTMsgSet(
- ubuntu_pofile.potemplate, singular, sequence=1)
+ ubuntu_pofile.potemplate, singular)
ubuntu = factory.makeCurrentTranslationMessage(
pofile=ubuntu_pofile, potmsgset=ubuntu_potmsgset,
translations=upstream.translations)
=== modified file 'lib/lp/translations/tests/test_translationmerger.py'
--- lib/lp/translations/tests/test_translationmerger.py 2011-02-14 14:42:46 +0000
+++ lib/lp/translations/tests/test_translationmerger.py 2011-02-18 15:15:35 +0000
@@ -76,9 +76,9 @@
# sharing templates had matching POTMsgSets, they will share
# one.
trunk_potmsgset = self.factory.makePOTMsgSet(
- self.trunk_template, singular='foo', sequence=1)
+ self.trunk_template, singular='foo')
stable_potmsgset = self.factory.makePOTMsgSet(
- self.stable_template, singular='foo', sequence=1)
+ self.stable_template, singular='foo')
self.merger.mergePOTMsgSets()
@@ -92,9 +92,9 @@
# merge_potmsgsets can be run again on a situation it's
# produced. It will produce the same situation.
trunk_potmsgset = self.factory.makePOTMsgSet(
- self.trunk_template, singular='foo', sequence=1)
+ self.trunk_template, singular='foo')
stable_potmsgset = self.factory.makePOTMsgSet(
- self.stable_template, singular='foo', sequence=1)
+ self.stable_template, singular='foo')
self.merger.mergePOTMsgSets()
self.merger.mergePOTMsgSets()
@@ -108,9 +108,9 @@
def test_unmatchedPOTMsgSetsDoNotShare(self):
# Only identically-keyed potmsgsets get merged.
trunk_potmsgset = self.factory.makePOTMsgSet(
- self.trunk_template, singular='foo', sequence=1)
+ self.trunk_template, singular='foo')
stable_potmsgset = self.factory.makePOTMsgSet(
- self.stable_template, singular='foo', context='bar', sequence=1)
+ self.stable_template, singular='foo', context='bar')
self.merger.mergePOTMsgSets()
@@ -152,10 +152,10 @@
super(TranslatedProductMixin, self).setUpProduct()
self.trunk_potmsgset = self.factory.makePOTMsgSet(
- self.trunk_template, singular='foo', sequence=1)
+ self.trunk_template, singular='foo')
self.stable_potmsgset = self.factory.makePOTMsgSet(
- self.stable_template, singular='foo', sequence=1)
+ self.stable_template, singular='foo')
self.msgid = self.trunk_potmsgset.msgid_singular
=== modified file 'lib/lp/translations/tests/test_translationmessage.py'
--- lib/lp/translations/tests/test_translationmessage.py 2011-02-15 12:07:51 +0000
+++ lib/lp/translations/tests/test_translationmessage.py 2011-02-18 15:15:35 +0000
@@ -810,11 +810,9 @@
self.other_template = self.factory.makePOTemplate(
productseries=self.trunk, name="other")
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.template, singular='foo', plural='foos',
- sequence=1)
+ potemplate=self.template, singular='foo', plural='foos')
self.other_potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.other_template, singular='bar', plural='bars',
- sequence=1)
+ potemplate=self.other_template, singular='bar', plural='bars')
self.pofile = self.factory.makePOFile(
potemplate=self.template, language_code='nl')
self.other_pofile = self.factory.makePOFile(
=== modified file 'lib/lp/translations/tests/test_translations_to_review.py'
--- lib/lp/translations/tests/test_translations_to_review.py 2010-12-09 19:49:36 +0000
+++ lib/lp/translations/tests/test_translations_to_review.py 2011-02-18 15:15:35 +0000
@@ -78,7 +78,7 @@
self.pofile = removeSecurityProxy(self.factory.makePOFile(
potemplate=self.potemplate, language_code='nl'))
self.potmsgset = self.factory.makePOTMsgSet(
- potemplate=self.potemplate, singular='hi', sequence=1)
+ potemplate=self.potemplate, singular='hi')
self.translation = self.factory.makeCurrentTranslationMessage(
potmsgset=self.potmsgset, pofile=self.pofile,
translator=self.person, translations=['bi'],