Merge lp:~benji/launchpad/bug-742662 into lp:launchpad
Status: | Rejected |
---|---|
Rejected by: | Benji York |
Proposed branch: | lp:~benji/launchpad/bug-742662 |
Merge into: | lp:launchpad |
Diff against target: |
313 lines (+146/-14) 5 files modified
lib/lp/translations/utilities/sanitize.py (+23/-7) lib/lp/translations/utilities/tests/test_file_importer.py (+22/-4) lib/lp/translations/utilities/tests/test_sanitize.py (+21/-0) lib/lp/translations/utilities/tests/test_translation_importer.py (+63/-1) lib/lp/translations/utilities/translation_import.py (+17/-2) |
To merge this branch: | bzr merge lp:~benji/launchpad/bug-742662 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+74254@code.launchpad.net |
Commit message
[r=gmb][bug=742662] report mixed newline usage when importing translations
Description of the change
Bug 742662 describes a scenario in which an imported translation
contains mixed newlines (\r as well as \n) and outlines three possible
fixes. This branch implements the option of disallowing such imports.
The software in place intended to do so, but the code to generate the
exception denoting a mixed newline condition was not being called. This
branch adds that code and tests for it.
The Sanitize class had a method that both normalized newlines as well as
reporting mixed newline violations. It didn't make sense to separate
out those two bits of functionality so I added a facade
(verifyNewlineC
(discarding the normalized result) and used that. I then added an
intermediary function (verify_
the newline verification to every string of natural-language text in a
translation message and then called that function when importing a
message (in importFile in
lib/lp/
Tests: the new tests that were added (and several related tests) can be
run with this command:
bin/test -c -t test_sanitize -t test_file_importer \
-t test_translatio
Lint: the "make lint" report is clean (after fixing some pre-existing
lint).
QA: I honestly don't know how to QA this. I'll have to ask Danilo or
one of the other translations guys. It might be that I can export the
template mentioned in the bug report
(https:/
and reimport it. It should generate an error message about mixed
newlines on reimport.