launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00496
[Merge] lp:~jtv/launchpad/recife-dummytm-init-flags into lp:~launchpad/launchpad/recife
Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/recife-dummytm-init-flags into lp:~launchpad/launchpad/recife.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers): code
= DummyTranslationMessage and "current" =
This fixes a very, very minor annoyance in the Recife feature branch. I can't think of or find any actual functionality that it would affect. DummyTranslationMessage.__init__ creates a dummy message that's marked as current. It should be up to the caller to make the message current (or not). Moreover, this is in our feature branch where the meaning of the "current" flags has changed, and __init__ can't even know which of the two flags it should set.
To satisfy the apparent intention of getCurrentDummyTranslationMessage, I updated it to make the message current itself—but using traits so that it sets the right flag. A new test in test_potmsgset.py verifies that behaviour.
I also deleted a small bit of doctest. In the old model, it verified that the "current dummy" translation message for a productseries template was not "imported." It was mechanically converted to use one of the new flags. In the new model, the whole notion that this old flag represented doesn't exist any more: the translations for the productseries template itself fulfill the role of the "imported" translations. There don't appear to be any consequences for that test line, and I don't think it's appropriate now.
What tests to run? I ran at least these:
{{{
./bin/test -vvc -m lp.translations.tests
./bin/test -vvc -m lp.translations.browser
./bin/test -vvc -m lp.translations -t stories -t dummy
}}}
To run just the very most interesting ones:
{{{
./bin/test -vvc -m lp.translations.tests.test_potmsgset -t dummy
./bin/test -vvc -m lp.translations -t potmsgset.txt
}}}
Jeroen
--
https://code.launchpad.net/~jtv/launchpad/recife-dummytm-init-flags/+merge/32135
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/recife-dummytm-init-flags into lp:~launchpad/launchpad/recife.
=== modified file 'lib/lp/translations/doc/potmsgset.txt'
--- lib/lp/translations/doc/potmsgset.txt 2010-08-04 11:00:51 +0000
+++ lib/lp/translations/doc/potmsgset.txt 2010-08-09 18:19:42 +0000
@@ -467,8 +467,6 @@
1
>>> pt_BR_dummy_current.translations
[None]
- >>> pt_BR_dummy_current.is_current_upstream
- False
A TranslationMessage knows what language it is in.
=== modified file 'lib/lp/translations/model/potmsgset.py'
--- lib/lp/translations/model/potmsgset.py 2010-08-09 08:09:26 +0000
+++ lib/lp/translations/model/potmsgset.py 2010-08-09 18:19:42 +0000
@@ -298,7 +298,10 @@
assert self.getCurrentTranslationMessage(potemplate,
language) is None, (
'There is already a translation message in our database.')
- return DummyTranslationMessage(pofile, self)
+
+ dummy = DummyTranslationMessage(pofile, self)
+ potemplate.translation_side_traits.setFlag(dummy, True)
+ return dummy
def _getUsedTranslationMessage(self, potemplate, language, variant,
current=True):
=== modified file 'lib/lp/translations/model/translationmessage.py'
--- lib/lp/translations/model/translationmessage.py 2010-08-09 08:09:26 +0000
+++ lib/lp/translations/model/translationmessage.py 2010-08-09 18:19:42 +0000
@@ -131,7 +131,7 @@
self.comment = None
self.origin = RosettaTranslationOrigin.ROSETTAWEB
self.validation_status = TranslationValidationStatus.UNKNOWN
- self.is_current_ubuntu = True
+ self.is_current_ubuntu = False
self.is_complete = False
self.is_current_upstream = False
self.is_empty = True
=== modified file 'lib/lp/translations/tests/test_potmsgset.py'
--- lib/lp/translations/tests/test_potmsgset.py 2010-08-06 07:18:14 +0000
+++ lib/lp/translations/tests/test_potmsgset.py 2010-08-09 18:19:42 +0000
@@ -183,6 +183,13 @@
self.potmsgset.getCurrentDummyTranslationMessage,
self.devel_potemplate, serbian)
+ def test_getCurrentDummyTranslationMessage_is_current(self):
+ # getCurrentDummyTranslationMessage returns a current message.
+ frysian = getUtility(ILanguageSet).getLanguageByCode('fy')
+ dummy = self.potmsgset.getCurrentDummyTranslationMessage(
+ self.devel_potemplate, frysian)
+ self.assertTrue(dummy.is_current_upstream)
+
def test_getCurrentTranslationMessage(self):
"""Test how shared and diverged current translation messages
interact."""
Follow ups