Merge lp:~jtv/launchpad/recife-new-resetcurrenttranslation into lp:~launchpad/launchpad/recife
Status: | Merged |
---|---|
Approved by: | Michael Nelson |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9164 |
Proposed branch: | lp:~jtv/launchpad/recife-new-resetcurrenttranslation |
Merge into: | lp:~launchpad/launchpad/recife |
Diff against target: |
406 lines (+188/-90) 4 files modified
lib/lp/translations/browser/translationmessage.py (+15/-16) lib/lp/translations/interfaces/potmsgset.py (+23/-10) lib/lp/translations/model/potmsgset.py (+39/-17) lib/lp/translations/tests/test_potmsgset.py (+111/-47) |
To merge this branch: | bzr merge lp:~jtv/launchpad/recife-new-resetcurrenttranslation |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | code | Approve | |
Review via email: mp+33747@code.launchpad.net |
Commit message
resetCurrentTra
Description of the change
= resetCurrentTra
For the Recife feature branch, upon discussion with Danilo. This re-implements POTMsgSet.
However that change breaks a view test. The breakage would have been hard to fix (without getting very dirty and making it very brittle) because the one call to resetCurrentTra
So I renamed the old resetCurrentTra
You will see a few things in this branch that may shock you, dear reviewer:
1. old_resetCurren
2. There are no tests for old_resetCurren
How do I look myself in the mirror? Well, I feel it all makes sense if you'll give me a chance to explain.
First, we want old_resetCurren
Second, we want old_resetCurren
With that I conclude my case. I hope I managed to convey the fact that we want old_resetCurren
To test:
{{{
./bin/test -vvc -m lp.translations
./bin/test -vvc -m lp.translations -t pofile-
}}}
No lint left, apart from a few pre-existing complaints about comments surrounded by blank lines. In all of the cases I didn't fix, I felt the code had a legitimate need for creative license. Plus, I don't want to avoid _too_ many conflicts with other people's ongoing work!
Jeroen
Heh... I enjoyed reading your MP description :)
And yes, I've been in that position before too... the one case (a transition to new infrastructure) where a bad name is a good one.
I've just got one question below about "the other side". But r=me. And great tests :)
> === modified file 'lib/lp/ translations/ browser/ translationmess age.py' translations/ browser/ translationmess age.py 2010-08-23 08:35:29 +0000 translations/ browser/ translationmess age.py 2010-08-26 10:24:07 +0000
> --- lib/lp/
> +++ lib/lp/
> @@ -300,16 +299,16 @@
>
> if self.request.method == 'POST':
> if self.user is None:
> - raise UnexpectedFormData, (
> - 'Anonymous users or users who are not accepting our '
> - 'licensing terms cannot do POST submissions.')
> + raise UnexpectedFormData(
> + "Anonymous users or users who are not accepting our "
> + "licensing terms cannot do POST submissions.")
Out of interest, is switching to double-quotes by default a personal
preference or a new LP coding recommendation?
> === modified file 'lib/lp/ translations/ model/potmsgset .py' translations/ model/potmsgset .py 2010-08-24 11:39:06 +0000 translations/ model/potmsgset .py 2010-08-26 10:24:07 +0000 nslation( self, pofile, lock_timestamp): lock_timestamp is not None) tTranslation( self, pofile, lock_timestamp): TranslationMess age( eTranslationCon flict(current, lock_timestamp) is_current_ ubuntu = False is_current_ upstream:
> --- lib/lp/
> +++ lib/lp/
> @@ -1295,25 +1295,47 @@
>
> return message
>
> - def resetCurrentTra
> - """See `IPOTMsgSet`."""
> -
> - assert(
> -
> + def old_resetCurren
> + """See `POTMsgSet`.
> +
> + This message is OBSOLETE in the Recife feature branch. It's
> + still here only until we replace its one call with the new
> + method.
> + """
> + assert lock_timestamp is not None, "No lock timestamp given."
> current = self.getCurrent
> pofile.potemplate, pofile.language)
> -
> - if (current is not None):
> - # Check for translation conflicts and update the required
> - # attributes.
> - self._maybeRais
> - current.
> - # Converge the current translation only if it is diverged and not
> - # current upstream.
> - is_diverged = current.potemplate is not None
> - if is_diverged and not current.
> - current.potemplate = None
> - pofile.date_changed = UTC_NOW
> + if current is None:
> + return
Nice... I prefer guard code like this too :)
> + eTranslationCon flict(current, lock_timestamp) is_current_ ubuntu = False is_current_ upstream: markChanged( ) nslation( ...
> + # Check for translation conflicts and update the required
> + # attributes.
> + self._maybeRais
> + current.
> + # Converge the current translation only if it is diverged and
> + # not current upstream.
> + if current.is_diverged and not current.
> + current.potemplate = None
> + pofile.
> +
> + def resetCurrentTra