launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24525
[Merge] ~cjwatson/launchpad:py3-syntax-avoid-ur-literals into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-syntax-avoid-ur-literals into launchpad:master.
Commit message:
Avoid ur'...' literals
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/381333
PEP 414 reintroduced u'...' literals into Python 3.3, but explicitly excluded "raw" Unicode literals. Rephrase Launchpad's uses of those in other ways.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-syntax-avoid-ur-literals into launchpad:master.
diff --git a/lib/lp/translations/utilities/doc/gettext_po_exporter.txt b/lib/lp/translations/utilities/doc/gettext_po_exporter.txt
index a881ea0..62dcaec 100644
--- a/lib/lp/translations/utilities/doc/gettext_po_exporter.txt
+++ b/lib/lp/translations/utilities/doc/gettext_po_exporter.txt
@@ -221,7 +221,7 @@ For compatibility with msgcat -w, it also wraps on \\ properly.
There are a couple of other characters that will be escaped in the
output, too.
- >>> translation_message.msgid_singular = (ur'"' + u"\t\r")
+ >>> translation_message.msgid_singular = (u'"\t\r')
>>> print export_translation_message(translation_message, wrap_width=10)
msgid ""
"\"\t\r"
diff --git a/lib/lp/translations/utilities/gettext_po_exporter.py b/lib/lp/translations/utilities/gettext_po_exporter.py
index 16b9d10..2b13c1c 100644
--- a/lib/lp/translations/utilities/gettext_po_exporter.py
+++ b/lib/lp/translations/utilities/gettext_po_exporter.py
@@ -108,7 +108,7 @@ def wrap_text(text, prefix, wrap_width):
def local_escape(text):
ret = text.replace(u'\\', u'\\\\')
- ret = ret.replace(ur'"', ur'\"')
+ ret = ret.replace(u'"', u'\\"')
ret = ret.replace(u'\t', u'\\t')
ret = ret.replace(u'\r', u'\\r')
return ret.replace(u'\n', u'\\n')
diff --git a/lib/lp/translations/utilities/tests/test_xpi_po_exporter.py b/lib/lp/translations/utilities/tests/test_xpi_po_exporter.py
index ca830c7..982fb97 100644
--- a/lib/lp/translations/utilities/tests/test_xpi_po_exporter.py
+++ b/lib/lp/translations/utilities/tests/test_xpi_po_exporter.py
@@ -279,33 +279,33 @@ class XPIPOExporterTestCase(TestCase):
self.translation_exporter.exportTranslationFile(
translation_file_data, storage)
- expected_template = dedent(ur'''
+ expected_template = dedent(u'''
#, fuzzy
msgid ""
msgstr ""
- "<?xml version=\"1.0\"?>\n"
- "<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n"
- " xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n"
- " <Description about=\"urn:mozilla:install-manifest\"\n"
- " em:id=\"langpack-en-US@xxxxxxxxxxxxxxxxxxx\"\n"
- " em:name=\"English U.S. (en-US) Language Pack\"\n"
- " em:version=\"2.0\"\n"
- " em:type=\"8\"\n"
- " em:creator=\"Danilo \u0160egan\">\n"
- " <em:contributor>\u0414\u0430\u043d\u0438\u043b\u043e \u0428\u0435\u0433\u0430\u043d</em:contributor>\n"
- " <em:contributor>Carlos Perell\u00f3 Mar\u00edn "
- "<carlos@xxxxxxxxxxxxx></em:contributor>\n"
- "\n"
- " <em:targetApplication>\n"
- " <Description>\n"
+ "<?xml version=\\"1.0\\"?>\\n"
+ "<RDF xmlns=\\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\\"\\n"
+ " xmlns:em=\\"http://www.mozilla.org/2004/em-rdf#\\">\\n"
+ " <Description about=\\"urn:mozilla:install-manifest\\"\\n"
+ " em:id=\\"langpack-en-US@xxxxxxxxxxxxxxxxxxx\\"\\n"
+ " em:name=\\"English U.S. (en-US) Language Pack\\"\\n"
+ " em:version=\\"2.0\\"\\n"
+ " em:type=\\"8\\"\\n"
+ " em:creator=\\"Danilo Šegan\\">\\n"
+ " <em:contributor>Данило Шеган</em:contributor>\\n"
+ " <em:contributor>Carlos Perelló Marín "
+ "<carlos@xxxxxxxxxxxxx></em:contributor>\\n"
+ "\\n"
+ " <em:targetApplication>\\n"
+ " <Description>\\n"
" <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id><!-- firefox --"
- ">\n"
- " <em:minVersion>2.0</em:minVersion>\n"
- " <em:maxVersion>2.0.0.*</em:maxVersion>\n"
- " </Description>\n"
- " </em:targetApplication>\n"
- " </Description>\n"
- "</RDF>\n"
+ ">\\n"
+ " <em:minVersion>2.0</em:minVersion>\\n"
+ " <em:maxVersion>2.0.0.*</em:maxVersion>\\n"
+ " </Description>\\n"
+ " </em:targetApplication>\\n"
+ " </Description>\\n"
+ "</RDF>\\n"
#. This is a DTD file inside a subdirectory
#: jar:chrome/en-US.jar!/subdir/test2.dtd(foozilla.menu.title)
@@ -381,7 +381,7 @@ class XPIPOExporterTestCase(TestCase):
#: jar:chrome/en-US.jar!/test1.properties:5(foozilla.utf8)
msgctxt "main/test1.properties"
- msgid "\u0414\u0430\u043d=Day"
+ msgid "Дан=Day"
msgstr ""
''').strip()