Code review comment for lp:~henninge/launchpad/bug-408899

Revision history for this message
Henning Eggers (henninge) wrote :

= Probelem and fix =

The TranslationBranchApprover creates potemplate names from file names. These names must be a "valid_name" as defined by the database constraint of that name. Unfortunately the conversion method only took underscores into account, converting them to dashes.

This fix makes sure that the names produced conform to the valid_name constraint, most notably making all letters lower case. It also uses sanitize_name to remove all other invalid characters from the name.

= Test =

bin/test -vv -ttemplate_name

= Demo and QA =

Configure a product series to import translation templates from a branch. Push a pot file with capital letters and other invalid characters in it to that branch. Wait for that file to be uploaded to the translation import queue and you can see that it creates a potemplate entry with a valid name. In fact, without this fix it would not have been uploaded at all.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/translations/model/translationbranchapprover.py
  lib/lp/translations/tests/test_translationbranchapprover.py

« Back to merge proposal