Merge lp:~cjwatson/launchpad/translations-doctests-future-imports into lp:launchpad
- translations-doctests-future-imports
- Merge into devel
Proposed by
Colin Watson
Status: | Merged |
---|---|
Merged at revision: | 18676 |
Proposed branch: | lp:~cjwatson/launchpad/translations-doctests-future-imports |
Merge into: | lp:launchpad |
Diff against target: |
3119 lines (+404/-417) 38 files modified
lib/lp/translations/doc/browser-helpers.txt (+19/-18) lib/lp/translations/doc/canonical_url_examples.txt (+4/-4) lib/lp/translations/doc/distroseries-language.txt (+15/-16) lib/lp/translations/doc/distroseries-translations-copy.txt (+9/-9) lib/lp/translations/doc/fix_translation_credits.txt (+2/-2) lib/lp/translations/doc/language.txt (+2/-2) lib/lp/translations/doc/poexport-language-pack.txt (+13/-15) lib/lp/translations/doc/poexport-queue.txt (+3/-5) lib/lp/translations/doc/poexport-request-productseries.txt (+1/-2) lib/lp/translations/doc/poexport-request.txt (+3/-4) lib/lp/translations/doc/poexportqueue-replication-lag.txt (+2/-2) lib/lp/translations/doc/pofile-verify-stats.txt (+3/-4) lib/lp/translations/doc/pofile.txt (+42/-42) lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt (+6/-7) lib/lp/translations/doc/poimport-pofile-old-po-imported.txt (+9/-9) lib/lp/translations/doc/poimport-pofile-syntax-error.txt (+21/-23) lib/lp/translations/doc/poimport-potemplate-syntax-error.txt (+8/-8) lib/lp/translations/doc/poimport.txt (+30/-30) lib/lp/translations/doc/potemplate.txt (+15/-16) lib/lp/translations/doc/potmsgset.txt (+21/-22) lib/lp/translations/doc/potranslation.txt (+2/-3) lib/lp/translations/doc/remove-translations-by.txt (+4/-4) lib/lp/translations/doc/rosetta-karma.txt (+3/-3) lib/lp/translations/doc/rosetta-poimport-script.txt (+3/-4) lib/lp/translations/doc/sourcepackagerelease-translations.txt (+18/-20) lib/lp/translations/doc/translationbranchapprover.txt (+23/-24) lib/lp/translations/doc/translationbuildapprover.txt (+10/-11) lib/lp/translations/doc/translationgroup.txt (+10/-10) lib/lp/translations/doc/translationimportqueue.txt (+57/-57) lib/lp/translations/doc/translationmessage-destroy.txt (+2/-2) lib/lp/translations/doc/translationmessage.txt (+8/-8) lib/lp/translations/doc/translationrelicensingagreement.txt (+6/-6) lib/lp/translations/doc/translations-export-to-branch.txt (+3/-3) lib/lp/translations/doc/translationsoverview.txt (+3/-3) lib/lp/translations/doc/translationsperson.txt (+3/-5) lib/lp/translations/doc/vpoexport.txt (+7/-7) lib/lp/translations/doc/vpotexport.txt (+1/-1) lib/lp/translations/tests/test_doc.py (+13/-6) |
To merge this branch: | bzr merge lp:~cjwatson/launchpad/translations-doctests-future-imports |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+347327@code.launchpad.net |
Commit message
Convert doctests under lp.translations to Launchpad's preferred __future__ imports.
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/translations/doc/browser-helpers.txt' |
2 | --- lib/lp/translations/doc/browser-helpers.txt 2017-08-07 08:17:31 +0000 |
3 | +++ lib/lp/translations/doc/browser-helpers.txt 2018-06-02 14:12:45 +0000 |
4 | @@ -12,30 +12,30 @@ |
5 | |
6 | Normal strings get passed through unmodified. |
7 | |
8 | - >>> contract_rosetta_escapes('foo') |
9 | - 'foo' |
10 | - >>> contract_rosetta_escapes('foo\\nbar') |
11 | - 'foo\\nbar' |
12 | + >>> print(contract_rosetta_escapes('foo')) |
13 | + foo |
14 | + >>> print(contract_rosetta_escapes('foo\\nbar')) |
15 | + foo\nbar |
16 | |
17 | The string '[tab]' gets converted to a tab character. |
18 | |
19 | >>> contract_rosetta_escapes('foo[tab]bar') |
20 | - 'foo\tbar' |
21 | + u'foo\tbar' |
22 | |
23 | The string '\[tab]' gets converted to a literal '[tab]'. |
24 | |
25 | - >>> contract_rosetta_escapes('foo\\[tab]bar') |
26 | - 'foo[tab]bar' |
27 | + >>> print(contract_rosetta_escapes('foo\\[tab]bar')) |
28 | + foo[tab]bar |
29 | |
30 | The string '\\[tab]' gets converted to a literal '\[tab]'. |
31 | |
32 | - >>> contract_rosetta_escapes('foo\\\\[tab]bar') |
33 | - 'foo\\[tab]bar' |
34 | + >>> print(contract_rosetta_escapes('foo\\\\[tab]bar')) |
35 | + foo\[tab]bar |
36 | |
37 | And so on... |
38 | |
39 | - >>> contract_rosetta_escapes('foo\\\\\\[tab]bar') |
40 | - 'foo\\\\[tab]bar' |
41 | + >>> print(contract_rosetta_escapes('foo\\\\\\[tab]bar')) |
42 | + foo\\[tab]bar |
43 | |
44 | Similarly, string '[nbsp]' gets converted to no-break space character. |
45 | |
46 | @@ -44,8 +44,8 @@ |
47 | |
48 | The string '\[nbsp]' gets converted to a literal '[nbsp]'. |
49 | |
50 | - >>> contract_rosetta_escapes('foo\\[nbsp]bar') |
51 | - 'foo[nbsp]bar' |
52 | + >>> print(contract_rosetta_escapes('foo\\[nbsp]bar')) |
53 | + foo[nbsp]bar |
54 | |
55 | Similarly, string '[nnbsp]' gets converted to narrow no-break space |
56 | character. |
57 | @@ -55,8 +55,8 @@ |
58 | |
59 | The string '\[nnbsp]' gets converted to a literal '[nnbsp]'. |
60 | |
61 | - >>> contract_rosetta_escapes('foo\\[nnbsp]bar') |
62 | - 'foo[nnbsp]bar' |
63 | + >>> print(contract_rosetta_escapes('foo\\[nnbsp]bar')) |
64 | + foo[nnbsp]bar |
65 | |
66 | |
67 | expand_rosetta_escapes |
68 | @@ -129,11 +129,12 @@ |
69 | >>> parse_cformat_string('') |
70 | [] |
71 | >>> parse_cformat_string('foo') |
72 | - [('string', 'foo')] |
73 | + [('string', u'foo')] |
74 | >>> parse_cformat_string('blah %d blah') |
75 | - [('string', 'blah '), ('interpolation', '%d'), ('string', ' blah')] |
76 | + [('string', u'blah '), ('interpolation', u'%d'), ('string', u' blah')] |
77 | >>> parse_cformat_string('%sfoo%%bar%s') |
78 | - [('interpolation', '%s'), ('string', 'foo%%bar'), ('interpolation', '%s')] |
79 | + [('interpolation', u'%s'), ('string', u'foo%%bar'), |
80 | + ('interpolation', u'%s')] |
81 | >>> parse_cformat_string('%') |
82 | Traceback (most recent call last): |
83 | ... |
84 | |
85 | === modified file 'lib/lp/translations/doc/canonical_url_examples.txt' |
86 | --- lib/lp/translations/doc/canonical_url_examples.txt 2011-12-24 17:49:30 +0000 |
87 | +++ lib/lp/translations/doc/canonical_url_examples.txt 2018-06-02 14:12:45 +0000 |
88 | @@ -65,7 +65,7 @@ |
89 | >>> translationmessage = potmsgset.getCurrentTranslation( |
90 | ... pofile.potemplate, pofile.language, potemplate.translation_side) |
91 | >>> translationmessage.setPOFile(pofile) |
92 | - >>> print canonical_url(translationmessage) |
93 | + >>> print(canonical_url(translationmessage)) |
94 | http://transl.../hoary/+source/evolution/+pots/evolution-2.2/es/1 |
95 | |
96 | Even for a dummy one. |
97 | @@ -73,7 +73,7 @@ |
98 | >>> potmsgset = potemplate.getPOTMsgSetBySequence(20) |
99 | >>> translationmessage = potmsgset.getCurrentTranslationMessageOrDummy( |
100 | ... pofile) |
101 | - >>> print canonical_url(translationmessage) |
102 | + >>> print(canonical_url(translationmessage)) |
103 | http://transl.../hoary/+source/evolution/+pots/evolution-2.2/es/20 |
104 | |
105 | Upstream POTemplateSubsets work in much the same way, except they hang off a |
106 | @@ -103,7 +103,7 @@ |
107 | >>> translationmessage = potmsgset.getCurrentTranslation( |
108 | ... pofile.potemplate, pofile.language, potemplate.translation_side) |
109 | >>> translationmessage.setPOFile(pofile) |
110 | - >>> print canonical_url(translationmessage) |
111 | + >>> print(canonical_url(translationmessage)) |
112 | http://translations.../evolution/trunk/+pots/evolution-2.2/es/1 |
113 | |
114 | Even for a dummy PO msgset |
115 | @@ -111,7 +111,7 @@ |
116 | >>> potmsgset = potemplate.getPOTMsgSetBySequence(20) |
117 | >>> translationmessage = potmsgset.getCurrentTranslationMessageOrDummy( |
118 | ... pofile) |
119 | - >>> print canonical_url(translationmessage) |
120 | + >>> print(canonical_url(translationmessage)) |
121 | http://translations.../evolution/trunk/+pots/evolution-2.2/es/20 |
122 | |
123 | |
124 | |
125 | === modified file 'lib/lp/translations/doc/distroseries-language.txt' |
126 | --- lib/lp/translations/doc/distroseries-language.txt 2011-12-30 06:14:56 +0000 |
127 | +++ lib/lp/translations/doc/distroseries-language.txt 2018-06-02 14:12:45 +0000 |
128 | @@ -31,7 +31,7 @@ |
129 | contain messages. |
130 | |
131 | >>> for po in hoary_spanish.pofiles: |
132 | - ... print po.potemplate.name |
133 | + ... print(po.potemplate.name) |
134 | evolution-2.2 |
135 | pmount |
136 | pkgconf-mozilla |
137 | @@ -41,7 +41,7 @@ |
138 | |
139 | >>> hoary_templates = list(hoary.getCurrentTranslationTemplates()) |
140 | >>> for template in hoary_templates: |
141 | - ... print template.name |
142 | + ... print(template.name) |
143 | evolution-2.2 |
144 | man |
145 | man |
146 | @@ -59,9 +59,9 @@ |
147 | ... Creates `DummyPOFile`s where needed. Prints types. |
148 | ... """ |
149 | ... for pofile in distroserieslanguage.getPOFilesFor(templates): |
150 | - ... print "%s (%s) %s" % ( |
151 | + ... print("%s (%s) %s" % ( |
152 | ... pofile.potemplate.name, pofile.language.code, |
153 | - ... removeSecurityProxy(pofile).__class__) |
154 | + ... removeSecurityProxy(pofile).__class__)) |
155 | |
156 | >>> print_augmented_pofiles(hoary_spanish, hoary_templates) |
157 | evolution-2.2 (es) <class '...pofile.POFile'> |
158 | @@ -79,7 +79,7 @@ |
159 | listing. |
160 | |
161 | >>> for potemplate in hoary.getTranslationTemplates(): |
162 | - ... print potemplate.name |
163 | + ... print(potemplate.name) |
164 | evolution-2.2 |
165 | disabled-template |
166 | man |
167 | @@ -90,13 +90,13 @@ |
168 | This is the one obsolete template. |
169 | |
170 | >>> potemplate = hoary.getTranslationTemplateByName('disabled-template') |
171 | - >>> print potemplate.iscurrent |
172 | + >>> print(potemplate.iscurrent) |
173 | False |
174 | |
175 | Also, we can see that the template has an Spanish translation that |
176 | hoary_spanish.pofiles is hiding as expected. |
177 | |
178 | - >>> print potemplate.getPOFileByLang('es').title |
179 | + >>> print(potemplate.getPOFileByLang('es').title) |
180 | Spanish (es) translation of disabled-template in Ubuntu Hoary package |
181 | "evolution" |
182 | |
183 | @@ -104,7 +104,7 @@ |
184 | |
185 | >>> amharic = getUtility(ILanguageSet)['am'] |
186 | >>> hoary_amharic = hoary.getDistroSeriesLanguageOrDummy(amharic) |
187 | - >>> print hoary_amharic.__class__ |
188 | + >>> print(hoary_amharic.__class__) |
189 | <class '...DummyDistroSeriesLanguage'> |
190 | |
191 | English is not a translatable language because we store the source messages |
192 | @@ -133,7 +133,7 @@ |
193 | been extended, and the DummyDistroSeriesLanguage has not been similarly |
194 | extended. |
195 | |
196 | - >>> print IDistroSeriesLanguage.providedBy(hoary_amharic) |
197 | + >>> print(IDistroSeriesLanguage.providedBy(hoary_amharic)) |
198 | True |
199 | |
200 | |
201 | @@ -148,19 +148,19 @@ |
202 | |
203 | >>> potemplates = list(hoary.getCurrentTranslationTemplates()) |
204 | >>> evo = potemplates[0] |
205 | - >>> print evo.name |
206 | + >>> print(evo.name) |
207 | evolution-2.2 |
208 | >>> man1 = potemplates[1] |
209 | - >>> print man1.name |
210 | + >>> print(man1.name) |
211 | man |
212 | >>> man2 = potemplates[2] |
213 | - >>> print man2.name |
214 | + >>> print(man2.name) |
215 | man |
216 | >>> mozconf = potemplates[3] |
217 | - >>> print mozconf.name |
218 | + >>> print(mozconf.name) |
219 | pkgconf-mozilla |
220 | >>> pm = potemplates[4] |
221 | - >>> print pm.name |
222 | + >>> print(pm.name) |
223 | pmount |
224 | |
225 | OK, so we have the five templates. Let's set their priorities and see if |
226 | @@ -185,7 +185,7 @@ |
227 | And now we can confirm that priority does in fact dominate: |
228 | |
229 | >>> for pot in hoary.getCurrentTranslationTemplates(): |
230 | - ... print pot.priority, pot.name |
231 | + ... print(pot.priority, pot.name) |
232 | 9 pmount |
233 | 8 pkgconf-mozilla |
234 | 7 man |
235 | @@ -202,4 +202,3 @@ |
236 | man (am) <class '...pofile.DummyPOFile'> |
237 | man (am) <class '...pofile.DummyPOFile'> |
238 | evolution-2.2 (am) <class '...pofile.DummyPOFile'> |
239 | - |
240 | |
241 | === modified file 'lib/lp/translations/doc/distroseries-translations-copy.txt' |
242 | --- lib/lp/translations/doc/distroseries-translations-copy.txt 2014-08-20 06:41:00 +0000 |
243 | +++ lib/lp/translations/doc/distroseries-translations-copy.txt 2018-06-02 14:12:45 +0000 |
244 | @@ -89,7 +89,7 @@ |
245 | ... IPOTemplateSet).getSubset(distroseries=carty) |
246 | >>> len(carty_templates) |
247 | 2 |
248 | - >>> print sorted([template.name for template in carty_templates]) |
249 | + >>> print(sorted([template.name for template in carty_templates])) |
250 | [u'template1', u'template2'] |
251 | >>> carty_template1 = carty_templates.getPOTemplateByName('template1') |
252 | >>> carty_template2 = carty_templates.getPOTemplateByName('template2') |
253 | @@ -102,7 +102,7 @@ |
254 | |
255 | >>> all_pofiles = sum( |
256 | ... [list(template.pofiles) for template in carty_templates], []) |
257 | - >>> print sorted([pofile.path for pofile in all_pofiles]) |
258 | + >>> print(sorted([pofile.path for pofile in all_pofiles])) |
259 | [u'template1-domain-eo.po', |
260 | u'template2-domain-de.po', |
261 | u'template2-domain-eo.po'] |
262 | @@ -111,13 +111,13 @@ |
263 | in the new series. |
264 | |
265 | >>> potmsgsets = carty_template1.getPOTMsgSets() |
266 | - >>> print potmsgsets.count() |
267 | + >>> print(potmsgsets.count()) |
268 | 1 |
269 | >>> potmsgsets[0] == msgset11 |
270 | True |
271 | |
272 | >>> potmsgsets = carty_template2.getPOTMsgSets() |
273 | - >>> print potmsgsets.count() |
274 | + >>> print(potmsgsets.count()) |
275 | 2 |
276 | >>> potmsgsets[0] == msgset21 |
277 | True |
278 | @@ -164,7 +164,7 @@ |
279 | ... ['--distribution=foobuntu', '--series=darty']) |
280 | >>> returnvalue |
281 | 1 |
282 | - >>> print error_output |
283 | + >>> print(error_output) |
284 | INFO Creating lockfile: |
285 | /var/lock/launchpad-copy-missing-translations-foobuntu-darty.lock |
286 | ERROR Before this process starts, set the hide_all_translations and |
287 | @@ -192,7 +192,7 @@ |
288 | ... ['--distribution=foobuntu', '--series=darty', '--force']) |
289 | >>> returnvalue |
290 | 0 |
291 | - >>> print error_output |
292 | + >>> print(error_output) |
293 | INFO Creating lockfile: |
294 | /var/lock/launchpad-copy-missing-translations-foobuntu-darty.lock |
295 | INFO Starting... |
296 | @@ -229,7 +229,7 @@ |
297 | >>> dartempls = getUtility(IPOTemplateSet).getSubset(distroseries=darty) |
298 | >>> len(dartempls) |
299 | 2 |
300 | - >>> print sorted([template.name for template in dartempls]) |
301 | + >>> print(sorted([template.name for template in dartempls])) |
302 | [u'template1', u'template2'] |
303 | |
304 | The script defaults to copying from the given series' previous_series, |
305 | @@ -246,7 +246,7 @@ |
306 | ... ['--distribution=notbuntu', '--series=grumpy']) |
307 | >>> returnvalue |
308 | 2 |
309 | - >>> print error_output |
310 | + >>> print(error_output) |
311 | INFO Creating lockfile: |
312 | /var/lock/launchpad-copy-missing-translations-notbuntu-grumpy.lock |
313 | Usage: copy-distroseries-translations.py [options] |
314 | @@ -260,7 +260,7 @@ |
315 | ... '--from-distribution=foobuntu' , '--from-series=darty']) |
316 | >>> returnvalue |
317 | 0 |
318 | - >>> print error_output |
319 | + >>> print(error_output) |
320 | INFO Creating lockfile: |
321 | /var/lock/launchpad-copy-missing-translations-notbuntu-grumpy.lock |
322 | INFO Starting... |
323 | |
324 | === modified file 'lib/lp/translations/doc/fix_translation_credits.txt' |
325 | --- lib/lp/translations/doc/fix_translation_credits.txt 2011-12-28 17:03:06 +0000 |
326 | +++ lib/lp/translations/doc/fix_translation_credits.txt 2018-06-02 14:12:45 +0000 |
327 | @@ -6,9 +6,9 @@ |
328 | >>> from lp.testing.script import run_script |
329 | >>> (returncode, out, err) = run_script( |
330 | ... 'scripts/rosetta/fix_translation_credits.py') |
331 | - >>> print returncode |
332 | + >>> print(returncode) |
333 | 0 |
334 | - >>> print err |
335 | + >>> print(err) |
336 | INFO Creating lockfile: |
337 | /var/lock/launchpad-fix-translation-credits.lock |
338 | INFO Figuring out POFiles that need fixing: this may take a while... |
339 | |
340 | === modified file 'lib/lp/translations/doc/language.txt' |
341 | --- lib/lp/translations/doc/language.txt 2009-07-01 20:45:39 +0000 |
342 | +++ lib/lp/translations/doc/language.txt 2018-06-02 14:12:45 +0000 |
343 | @@ -11,7 +11,7 @@ |
344 | # translations. That other person is Foo Bar (name16). |
345 | >>> from lp.registry.interfaces.person import IPersonSet |
346 | >>> foo_bar = getUtility(IPersonSet).getByName('name16') |
347 | - >>> print foo_bar.displayname |
348 | + >>> print(foo_bar.displayname) |
349 | Foo Bar |
350 | |
351 | >>> from lp.services.worlddata.interfaces.language import ILanguageSet |
352 | @@ -22,6 +22,6 @@ |
353 | ... for karma_category_cache in translator.karma_category_caches: |
354 | ... if (karma_category_cache.category.name == 'translations'): |
355 | ... karma = karma_category_cache.karmavalue |
356 | - ... print (translator.displayname, karma) |
357 | + ... print((translator.displayname, karma)) |
358 | (u'Foo Bar', 164) |
359 | (u'Carlos Perell\xf3 Mar\xedn', 9) |
360 | |
361 | === modified file 'lib/lp/translations/doc/poexport-language-pack.txt' |
362 | --- lib/lp/translations/doc/poexport-language-pack.txt 2017-04-19 11:01:16 +0000 |
363 | +++ lib/lp/translations/doc/poexport-language-pack.txt 2018-06-02 14:12:45 +0000 |
364 | @@ -38,7 +38,7 @@ |
365 | ... size = 'bin' |
366 | ... else: |
367 | ... size = len(tarfile.extractfile(member).readlines()) |
368 | - ... print "| %5s | %s" % (size, member.name) |
369 | + ... print("| %5s | %s" % (size, member.name)) |
370 | |
371 | |
372 | Base language pack export using Librarian |
373 | @@ -60,7 +60,7 @@ |
374 | |
375 | Check that the log looks ok. |
376 | |
377 | - >>> print logger.getLogBuffer() |
378 | + >>> print(logger.getLogBuffer()) |
379 | DEBUG Selecting PO files for export |
380 | INFO Number of PO files to export: 12 |
381 | DEBUG Exporting PO file ... (1/12) |
382 | @@ -78,7 +78,7 @@ |
383 | The tarball has the right members. |
384 | |
385 | >>> for member in tarfile.getmembers(): |
386 | - ... print member.name |
387 | + ... print(member.name) |
388 | rosetta-hoary |
389 | ... |
390 | rosetta-hoary/es |
391 | @@ -91,8 +91,8 @@ |
392 | Directory permissions allow correct use of those directories: |
393 | |
394 | >>> directory = tarfile.getmember('rosetta-hoary') |
395 | - >>> '0o%o' % directory.mode |
396 | - '0o755' |
397 | + >>> print('0o%o' % directory.mode) |
398 | + 0o755 |
399 | |
400 | And one of the included .po files look like what we expected. |
401 | |
402 | @@ -119,7 +119,7 @@ |
403 | Get hold of a person. |
404 | |
405 | >>> mark = getUtility(IPersonSet).getByName('mark') |
406 | - >>> print mark.displayname |
407 | + >>> print(mark.displayname) |
408 | Mark Shuttleworth |
409 | |
410 | Get the Grumpy distro series. |
411 | @@ -301,7 +301,7 @@ |
412 | First, export without any existing base language pack: should get both |
413 | PO files. |
414 | |
415 | - >>> print series.language_pack_base |
416 | + >>> print(series.language_pack_base) |
417 | None |
418 | |
419 | >>> logger = BufferLogger() |
420 | @@ -317,7 +317,7 @@ |
421 | |
422 | Check that the log looks ok. |
423 | |
424 | - >>> print logger.getLogBuffer() |
425 | + >>> print(logger.getLogBuffer()) |
426 | DEBUG Selecting PO files for export |
427 | INFO Number of PO files to export: 4 |
428 | DEBUG Exporting PO file ... (1/4) |
429 | @@ -353,7 +353,7 @@ |
430 | Check the files look OK. |
431 | |
432 | >>> fh = tarfile.extractfile('rosetta-grumpy/es/LC_MESSAGES/test.po') |
433 | - >>> print fh.read().decode('UTF-8') |
434 | + >>> print(fh.read().decode('UTF-8')) |
435 | # Spanish translation for evolution |
436 | # Copyright (c) ... Rosetta Contributors and Canonical Ltd ... |
437 | # This file is distributed under the same license as the evolution pack... |
438 | @@ -377,7 +377,7 @@ |
439 | msgstr "blah (es)" |
440 | |
441 | >>> fh = tarfile.extractfile('rosetta-grumpy/cy/LC_MESSAGES/test.po') |
442 | - >>> print fh.read().decode('UTF-8') |
443 | + >>> print(fh.read().decode('UTF-8')) |
444 | # Welsh translation for evolution |
445 | # Copyright (c) ... Rosetta Contributors and Canonical Ltd ... |
446 | # This file is distributed under the same license as the evolution pack... |
447 | @@ -513,7 +513,7 @@ |
448 | |
449 | >>> proc = get_subprocess('cronscripts/language-pack-exporter.py') |
450 | >>> (out, err) = proc.communicate() |
451 | - >>> print err |
452 | + >>> print(err) |
453 | Traceback (most recent call last): |
454 | ... |
455 | lp.services.scripts.base.LaunchpadScriptFailure: |
456 | @@ -536,7 +536,7 @@ |
457 | >>> proc = get_subprocess( |
458 | ... 'cronscripts/language-pack-exporter.py ubuntu hoary') |
459 | >>> (out, err) = proc.communicate() |
460 | - >>> print err |
461 | + >>> print(err) |
462 | INFO Setting lockfile name to |
463 | launchpad-language-pack-exporter__ubuntu__hoary.lock. |
464 | INFO Creating lockfile: |
465 | @@ -549,10 +549,8 @@ |
466 | INFO Done. |
467 | INFO Registered the language pack. |
468 | |
469 | - >>> print out |
470 | + >>> print(out) |
471 | <BLANKLINE> |
472 | |
473 | >>> proc.returncode |
474 | 0 |
475 | - |
476 | - |
477 | |
478 | === modified file 'lib/lp/translations/doc/poexport-queue.txt' |
479 | --- lib/lp/translations/doc/poexport-queue.txt 2011-12-22 05:09:10 +0000 |
480 | +++ lib/lp/translations/doc/poexport-queue.txt 2018-06-02 14:12:45 +0000 |
481 | @@ -133,7 +133,7 @@ |
482 | Those are specially handled and reported. |
483 | |
484 | >>> try: |
485 | - ... raise AssertionError, "Really nasty \xc3 non-ASCII error!" |
486 | + ... raise AssertionError, b"Really nasty \xc3 non-ASCII error!" |
487 | ... except AssertionError: |
488 | ... result.addFailure() |
489 | >>> result.notify() |
490 | @@ -351,7 +351,7 @@ |
491 | >>> process_queue(transaction, logging.getLogger()) |
492 | INFO:root:Stored file at http://...eo.po |
493 | |
494 | - >>> print get_newest_librarian_file().read() |
495 | + >>> print(get_newest_librarian_file().read()) |
496 | # Esperanto translation for ... |
497 | ... |
498 | "X-Generator: Launchpad (build ...)\n" |
499 | @@ -372,7 +372,7 @@ |
500 | >>> process_queue(transaction, logging.getLogger()) |
501 | INFO:root:Stored file at http://...eo.po |
502 | |
503 | - >>> print get_newest_librarian_file().read() |
504 | + >>> print(get_newest_librarian_file().read()) |
505 | # IMPORTANT: This file does NOT contain a complete PO file structure. |
506 | # DO NOT attempt to import this file back into Launchpad. |
507 | ... |
508 | @@ -391,5 +391,3 @@ |
509 | >>> process_queue(fake_transaction, logging.getLogger()) |
510 | >>> len(pop_notifications()) |
511 | 0 |
512 | - |
513 | - |
514 | |
515 | === modified file 'lib/lp/translations/doc/poexport-request-productseries.txt' |
516 | --- lib/lp/translations/doc/poexport-request-productseries.txt 2014-01-30 09:58:18 +0000 |
517 | +++ lib/lp/translations/doc/poexport-request-productseries.txt 2018-06-02 14:12:45 +0000 |
518 | @@ -34,7 +34,6 @@ |
519 | |
520 | Now we request that the queue be processed. |
521 | |
522 | - >>> import logging |
523 | >>> import transaction |
524 | >>> from lp.translations.scripts.po_export_queue import process_queue |
525 | >>> logger = FakeLogger() |
526 | @@ -89,7 +88,7 @@ |
527 | >>> from lp.services.helpers import string_to_tarfile |
528 | >>> tarball = string_to_tarfile(urllib2.urlopen(url).read()) |
529 | >>> for name in sorted(tarball.getnames()): |
530 | - ... print name |
531 | + ... print(name) |
532 | evolution-2.2 |
533 | evolution-2.2/evolution-2.2-es.po |
534 | po |
535 | |
536 | === modified file 'lib/lp/translations/doc/poexport-request.txt' |
537 | --- lib/lp/translations/doc/poexport-request.txt 2014-02-27 09:30:38 +0000 |
538 | +++ lib/lp/translations/doc/poexport-request.txt 2018-06-02 14:12:45 +0000 |
539 | @@ -91,7 +91,7 @@ |
540 | >>> from lp.services.helpers import string_to_tarfile |
541 | >>> tarball = string_to_tarfile(urllib2.urlopen(url).read()) |
542 | >>> for name in sorted(tarball.getnames()): |
543 | - ... print name |
544 | + ... print(name) |
545 | pmount |
546 | pmount/pmount-ca.po |
547 | pmount/pmount-cs.po |
548 | @@ -115,7 +115,7 @@ |
549 | ... render_request(request) |
550 | ... for request in POExportRequest.select()] |
551 | ... for request in sorted(requests): |
552 | - ... print request |
553 | + ... print(request) |
554 | >>> print_queue() |
555 | |
556 | >>> request_set.addRequest(person, None, [ca]) |
557 | @@ -249,7 +249,7 @@ |
558 | ... stderr=subprocess.STDOUT |
559 | ... ) |
560 | >>> (output, empty) = process.communicate() |
561 | - >>> print output |
562 | + >>> print(output) |
563 | DEBUG ... |
564 | INFO Creating lockfile: /var/lock/launchpad-rosetta-export-queue.lock |
565 | DEBUG Exporting objects for Happy Downloader, related to template |
566 | @@ -265,4 +265,3 @@ |
567 | DEBUG rosetta-export-queue ran in ...s (excl. load & lock) |
568 | DEBUG Removing lock file: /var/lock/launchpad-rosetta-export-queue.lock |
569 | <BLANKLINE> |
570 | - |
571 | |
572 | === modified file 'lib/lp/translations/doc/poexportqueue-replication-lag.txt' |
573 | --- lib/lp/translations/doc/poexportqueue-replication-lag.txt 2013-06-20 05:50:00 +0000 |
574 | +++ lib/lp/translations/doc/poexportqueue-replication-lag.txt 2018-06-02 14:12:45 +0000 |
575 | @@ -53,7 +53,7 @@ |
576 | ... else: |
577 | ... summary.append('(template)') |
578 | ... for entry in sorted(summary): |
579 | - ... print entry |
580 | + ... print(entry) |
581 | |
582 | >>> summarize_request(queue.getRequest()) |
583 | (template) |
584 | @@ -75,7 +75,7 @@ |
585 | is still technically on the queue, but no longer "live." |
586 | |
587 | >>> person, sources, format, request_ids = repeated_request |
588 | - >>> print len(request_ids) |
589 | + >>> print(len(request_ids)) |
590 | 3 |
591 | >>> queue.removeRequest(request_ids) |
592 | |
593 | |
594 | === modified file 'lib/lp/translations/doc/pofile-verify-stats.txt' |
595 | --- lib/lp/translations/doc/pofile-verify-stats.txt 2012-08-06 22:14:44 +0000 |
596 | +++ lib/lp/translations/doc/pofile-verify-stats.txt 2018-06-02 14:12:45 +0000 |
597 | @@ -109,7 +109,7 @@ |
598 | ... if in_header: |
599 | ... in_header = (line != '') |
600 | ... else: |
601 | - ... print line |
602 | + ... print(line) |
603 | The POFile statistics verifier encountered errors while checking cached |
604 | statistics in the database: |
605 | <BLANKLINE> |
606 | @@ -129,10 +129,9 @@ |
607 | >>> from lp.testing.script import run_script |
608 | >>> (returncode, out, err) = run_script( |
609 | ... 'cronscripts/rosetta-pofile-stats.py', ['--start-id=99']) |
610 | - >>> print returncode |
611 | + >>> print(returncode) |
612 | 0 |
613 | - >>> print err |
614 | + >>> print(err) |
615 | INFO Creating lockfile: /var/lock/launchpad-pofile-stats.lock |
616 | INFO Starting verification of POFile stats at id 99 |
617 | INFO Done. |
618 | - |
619 | |
620 | === modified file 'lib/lp/translations/doc/pofile.txt' |
621 | --- lib/lp/translations/doc/pofile.txt 2016-01-26 15:47:37 +0000 |
622 | +++ lib/lp/translations/doc/pofile.txt 2018-06-02 14:12:45 +0000 |
623 | @@ -93,9 +93,9 @@ |
624 | ... translation = message.translations[0] |
625 | ... if len(translation) > 20: |
626 | ... translation = translation[:17] + "..." |
627 | - ... print "%2d. %-20s %-20s %-20s" % ( |
628 | + ... print("%2d. %-20s %-20s %-20s" % ( |
629 | ... potmsgset.getSequence(pofile.potemplate), |
630 | - ... singular, plural, translation) |
631 | + ... singular, plural, translation)) |
632 | |
633 | |
634 | getFullLanguageCode |
635 | @@ -103,11 +103,11 @@ |
636 | |
637 | Returns the complete code for this POFile's language. |
638 | |
639 | - >>> print potemplate.getPOFileByLang('es').getFullLanguageCode() |
640 | + >>> print(potemplate.getPOFileByLang('es').getFullLanguageCode()) |
641 | es |
642 | |
643 | >>> sr_latin = factory.makeLanguage('sr@latin', 'Serbian Latin') |
644 | - >>> print potemplate.getDummyPOFile(sr_latin).getFullLanguageCode() |
645 | + >>> print(potemplate.getDummyPOFile(sr_latin).getFullLanguageCode()) |
646 | sr@latin |
647 | |
648 | |
649 | @@ -116,10 +116,10 @@ |
650 | |
651 | Returns the complete English name for this POFile's language. |
652 | |
653 | - >>> print potemplate.getPOFileByLang('es').getFullLanguageName() |
654 | + >>> print(potemplate.getPOFileByLang('es').getFullLanguageName()) |
655 | Spanish |
656 | |
657 | - >>> print potemplate.getDummyPOFile(sr_latin).getFullLanguageName() |
658 | + >>> print(potemplate.getDummyPOFile(sr_latin).getFullLanguageName()) |
659 | Serbian Latin |
660 | |
661 | |
662 | @@ -289,7 +289,7 @@ |
663 | [u' traducci\xf3n de es.po al Spanish', |
664 | u' translation of es.po to Spanish'] |
665 | |
666 | - >>> print pofile.header |
667 | + >>> print(pofile.header) |
668 | Project-Id-Version: es |
669 | POT-Creation-Date: 2004-08-17 11:10+0200 |
670 | PO-Revision-Date: 2005-04-07 13:22+0000 |
671 | @@ -307,7 +307,7 @@ |
672 | |
673 | And the new header contains the new string. |
674 | |
675 | - >>> print pofile.header |
676 | + >>> print(pofile.header) |
677 | Project-Id-Version: es |
678 | Report-Msgid-Bugs-To: serrador@hispalinux.es |
679 | POT-Creation-Date: 2004-08-18 11:10+0200 |
680 | @@ -328,7 +328,7 @@ |
681 | translators forget to update that field from time to time and sometimes, |
682 | we were losing translations because we were ignoring those imports too. |
683 | |
684 | - >>> print pofile.header |
685 | + >>> print(pofile.header) |
686 | Project-Id-Version: es |
687 | ... |
688 | PO-Revision-Date: 2005-08-18 13:22+0000 |
689 | @@ -414,7 +414,7 @@ |
690 | the most common number of plural forms: |
691 | |
692 | >>> divehi = getUtility(ILanguageSet)['dv'] |
693 | - >>> print divehi.pluralforms |
694 | + >>> print(divehi.pluralforms) |
695 | None |
696 | |
697 | >>> evolution_dv = evolution_pot.getDummyPOFile(divehi) |
698 | @@ -431,7 +431,7 @@ |
699 | |
700 | >>> from lp.translations.model.pofile import POFile |
701 | >>> pofile = POFile.get(24) |
702 | - >>> print pofile.header |
703 | + >>> print(pofile.header) |
704 | Project-Id-Version: PACKAGE VERSION |
705 | ... |
706 | Content-Type: text/plain; charset=EUC-JP |
707 | @@ -445,16 +445,16 @@ |
708 | The header is not changed. |
709 | |
710 | >>> for i in range(len(stream_list)): |
711 | - ... if stream_list[i].startswith('"Content-Type:'): |
712 | - ... print stream_list[i] |
713 | + ... if stream_list[i].startswith(b'"Content-Type:'): |
714 | + ... print(stream_list[i]) |
715 | "Content-Type: text/plain; charset=EUC-JP\n" |
716 | |
717 | And checking one of the translations, we can see that it's using the |
718 | EUC-JP encoding. |
719 | |
720 | >>> for i in range(len(stream_list)): |
721 | - ... if (stream_list[i].startswith('msgstr') and |
722 | - ... 'prefs.js' in stream_list[i]): |
723 | + ... if (stream_list[i].startswith(b'msgstr') and |
724 | + ... b'prefs.js' in stream_list[i]): |
725 | ... break |
726 | >>> stream_list[i] |
727 | 'msgstr "\xc0\xdf\xc4\xea\xa4\xce\xa5\xab...\xa5\xba\xa4\xcb |
728 | @@ -469,15 +469,15 @@ |
729 | We can see that the header has been updated to have UTF-8 |
730 | |
731 | >>> for i in range(len(stream_list)): |
732 | - ... if stream_list[i].startswith('"Content-Type:'): |
733 | - ... print stream_list[i] |
734 | + ... if stream_list[i].startswith(b'"Content-Type:'): |
735 | + ... print(stream_list[i]) |
736 | "Content-Type: text/plain; charset=UTF-8\n" |
737 | |
738 | And the encoding used is also using UTF-8 chars. |
739 | |
740 | >>> for i in range(len(stream_list)): |
741 | - ... if (stream_list[i].startswith('msgstr') and |
742 | - ... 'prefs.js' in stream_list[i]): |
743 | + ... if (stream_list[i].startswith(b'msgstr') and |
744 | + ... b'prefs.js' in stream_list[i]): |
745 | ... break |
746 | >>> stream_list[i] |
747 | 'msgstr "\xe8\xa8\xad\xe5\xae\x9a\xe3\x81...\xba\xe3\x81\xab |
748 | @@ -490,7 +490,7 @@ |
749 | So for a concrete export, we have a message like: |
750 | |
751 | >>> pofile_es = potemplate.getPOFileByLang('es') |
752 | - >>> print pofile_es.export(force_utf8=True).decode('utf8') |
753 | + >>> print(pofile_es.export(force_utf8=True).decode('utf8')) |
754 | # ... |
755 | ... |
756 | #: addressbook/gui/widgets/foo.c:345 |
757 | @@ -507,7 +507,7 @@ |
758 | |
759 | # It has plural forms. |
760 | |
761 | - >>> print potmsgset.plural_text |
762 | + >>> print(potmsgset.plural_text) |
763 | %d bars |
764 | |
765 | # We change the plural form. |
766 | @@ -515,12 +515,12 @@ |
767 | >>> potmsgset.updatePluralForm(u'something else') |
768 | >>> from lp.services.database.sqlbase import flush_database_updates |
769 | >>> flush_database_updates() |
770 | - >>> print potmsgset.plural_text |
771 | + >>> print(potmsgset.plural_text) |
772 | something else |
773 | |
774 | ...the export reflects that change. |
775 | |
776 | - >>> print pofile_es.export(force_utf8=True).decode('utf8') |
777 | + >>> print(pofile_es.export(force_utf8=True).decode('utf8')) |
778 | # ... |
779 | ... |
780 | #: addressbook/gui/widgets/foo.c:345 |
781 | @@ -549,9 +549,9 @@ |
782 | |
783 | >>> potmsgset = pofile_sr.potemplate.getOrCreateSharedPOTMsgSet( |
784 | ... singular_text=msgid, plural_text=msgid_plural) |
785 | - >>> print potmsgset.getCurrentTranslation( |
786 | + >>> print(potmsgset.getCurrentTranslation( |
787 | ... pofile_sr.potemplate, pofile_sr.language, |
788 | - ... pofile_sr.potemplate.translation_side) |
789 | + ... pofile_sr.potemplate.translation_side)) |
790 | None |
791 | |
792 | Is time to create it. We need some extra privileges here. |
793 | @@ -568,13 +568,13 @@ |
794 | |
795 | As we can see, is the msgid we were looking for. |
796 | |
797 | - >>> print translation_message.potmsgset.msgid_singular.msgid |
798 | + >>> print(translation_message.potmsgset.msgid_singular.msgid) |
799 | Found %i invalid file. |
800 | |
801 | - >>> print pofile_sr.language.code |
802 | + >>> print(pofile_sr.language.code) |
803 | sr |
804 | |
805 | - >>> print translation_message.language.code |
806 | + >>> print(translation_message.language.code) |
807 | sr |
808 | |
809 | We created it without translations. |
810 | @@ -592,8 +592,8 @@ |
811 | >>> def print_names(persons): |
812 | ... """Print name for each of `persons`.""" |
813 | ... for person in persons: |
814 | - ... print person.name |
815 | - ... print "--" |
816 | + ... print(person.name) |
817 | + ... print("--") |
818 | |
819 | >>> evolution = getUtility(IProductSet).getByName('evolution') |
820 | >>> evolution_trunk = evolution.getSeries('trunk') |
821 | @@ -660,8 +660,8 @@ |
822 | translated for a given POFile. |
823 | |
824 | >>> def print_message_status(potmsgsets, pofile): |
825 | - ... print "%-10s %-5s %-10s %-11s" % ( |
826 | - ... "msgid", "form", "translat.", "Has plurals") |
827 | + ... print("%-10s %-5s %-10s %-11s" % ( |
828 | + ... "msgid", "form", "translat.", "Has plurals")) |
829 | ... for potmsgset in potmsgsets: |
830 | ... translationmessage = potmsgset.getCurrentTranslation( |
831 | ... pofile.potemplate, pofile.language, |
832 | @@ -676,9 +676,9 @@ |
833 | ... translation = translationmessage.translations[index] |
834 | ... if len(translation) > 10: |
835 | ... translation = translation[:7] + '...' |
836 | - ... print "%-10s %-5s %-10s %s" % ( |
837 | + ... print("%-10s %-5s %-10s %s" % ( |
838 | ... msgid, index, translation, |
839 | - ... potmsgset.msgid_plural is not None) |
840 | + ... potmsgset.msgid_plural is not None)) |
841 | |
842 | >>> potmsgsets_translated = evolution_es.getPOTMsgSetTranslated() |
843 | >>> print_message_status( |
844 | @@ -706,7 +706,7 @@ |
845 | >>> carlos = person_set.getByName('carlos') |
846 | >>> translationmessages = evolution_es.getTranslationsFilteredBy(carlos) |
847 | >>> for translationmessage in translationmessages: |
848 | - ... print translationmessage.translations |
849 | + ... print(translationmessage.translations) |
850 | [u'libreta de direcciones de Evolution'] |
851 | [u'carpeta de libretas de direcciones actual'] |
852 | [u'lalalala'] |
853 | @@ -751,7 +751,7 @@ |
854 | >>> current = potmsgset.getCurrentTranslation( |
855 | ... alsa_template, alsa_translation.language, |
856 | ... alsa_template.translation_side) |
857 | - >>> print current.translations |
858 | + >>> print(current.translations) |
859 | [u'This is a dummy translation so that |
860 | the credits are counted as translated.'] |
861 | |
862 | @@ -765,7 +765,7 @@ |
863 | >>> current = potmsgset.getCurrentTranslation( |
864 | ... alsa_template, alsa_translation.language, |
865 | ... alsa_template.translation_side) |
866 | - >>> print current.translations |
867 | + >>> print(current.translations) |
868 | [u'Happy translator'] |
869 | |
870 | If we submit non-upstream translation, it's rejected. |
871 | @@ -773,14 +773,14 @@ |
872 | >>> no_credits = potmsgset.submitSuggestion( |
873 | ... alsa_translation, alsa_translation.owner, |
874 | ... {0: u'Unhappy translator'}) |
875 | - >>> print no_credits |
876 | + >>> print(no_credits) |
877 | None |
878 | |
879 | >>> flush_database_updates() |
880 | >>> current = potmsgset.getCurrentTranslation( |
881 | ... alsa_template, alsa_translation.language, |
882 | ... alsa_template.translation_side) |
883 | - >>> print current.translations |
884 | + >>> print(current.translations) |
885 | [u'Happy translator'] |
886 | |
887 | |
888 | @@ -812,7 +812,7 @@ |
889 | We get an updated header based on some metadata in our database instead |
890 | of the imported one stored in POFile.header. |
891 | |
892 | - >>> print evolution_ja.header |
893 | + >>> print(evolution_ja.header) |
894 | Project-Id-Version: evolution |
895 | Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS> |
896 | POT-Creation-Date: 2005-05-06 20:39:27.778946+00:00 |
897 | @@ -824,7 +824,7 @@ |
898 | Content-Transfer-Encoding: 8bit |
899 | Plural-Forms: nplurals=1; plural=0 |
900 | |
901 | - >>> print translation_file_data.header.getRawContent() |
902 | + >>> print(translation_file_data.header.getRawContent()) |
903 | Project-Id-Version: evolution |
904 | Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS> |
905 | POT-Creation-Date: 2005-04-07 14:10+0200 |
906 | @@ -846,7 +846,7 @@ |
907 | |
908 | And the PO Revision Date matches when was the PO file last changed. |
909 | |
910 | - >>> print evolution_ja.date_changed |
911 | + >>> print(evolution_ja.date_changed) |
912 | 2005-10-11 23:08:01.899322+00:00 |
913 | |
914 | |
915 | |
916 | === modified file 'lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt' |
917 | --- lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2012-11-21 16:50:43 +0000 |
918 | +++ lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2018-06-02 14:12:45 +0000 |
919 | @@ -66,7 +66,7 @@ |
920 | header 'X-Rosetta-Export-Date'. That header is the one that notes that the |
921 | file comes from a previous export from Rosetta and when did it happen. |
922 | |
923 | - >>> pofile_contents = r''' |
924 | + >>> pofile_contents = br''' |
925 | ... msgid "" |
926 | ... msgstr "" |
927 | ... "PO-Revision-Date: 2005-06-03 19:41+0100\n" |
928 | @@ -100,7 +100,7 @@ |
929 | >>> subject |
930 | u'Import problem - Welsh (cy) - firefox in Mozilla Firefox trunk' |
931 | |
932 | - >>> print message |
933 | + >>> print(message) |
934 | Hello Mark Shuttleworth, |
935 | <BLANKLINE> |
936 | On ..., you uploaded a file with |
937 | @@ -127,7 +127,7 @@ |
938 | A much shorter version of that information is stored in the entry's |
939 | error_output. |
940 | |
941 | - >>> print entry.error_output |
942 | + >>> print(entry.error_output) |
943 | File was not exported from Launchpad. |
944 | |
945 | We should also be sure that we don't block any import that is coming from |
946 | @@ -168,14 +168,13 @@ |
947 | The import code has also composed an email with the notification of the |
948 | import. |
949 | |
950 | - >>> print subject |
951 | + >>> print(subject) |
952 | None |
953 | - >>> print message |
954 | + >>> print(message) |
955 | Hello Mark Shuttleworth, |
956 | ... |
957 | |
958 | There was no error output this time. |
959 | |
960 | - >>> print entry.error_output |
961 | + >>> print(entry.error_output) |
962 | None |
963 | - |
964 | |
965 | === modified file 'lib/lp/translations/doc/poimport-pofile-old-po-imported.txt' |
966 | --- lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2012-11-21 16:50:43 +0000 |
967 | +++ lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2018-06-02 14:12:45 +0000 |
968 | @@ -62,7 +62,7 @@ |
969 | |
970 | First, we do a valid import. |
971 | |
972 | - >>> pofile_contents = r''' |
973 | + >>> pofile_contents = br''' |
974 | ... msgid "" |
975 | ... msgstr "" |
976 | ... "PO-Revision-Date: 2005-05-03 20:41+0100\n" |
977 | @@ -88,7 +88,7 @@ |
978 | We do the import. This succeeds without errors. |
979 | |
980 | >>> (subject, message) = pofile.importFromQueue(entry) |
981 | - >>> print entry.error_output |
982 | + >>> print(entry.error_output) |
983 | None |
984 | |
985 | The status is now IMPORTED: |
986 | @@ -102,7 +102,7 @@ |
987 | We can see that the header has the same 'PO-Revision-Date' as the |
988 | file we just imported. |
989 | |
990 | - >>> print pofile.header |
991 | + >>> print(pofile.header) |
992 | Project-Id-Version:... |
993 | PO-Revision-Date: 2005-05-03 20:41+0100 |
994 | ... |
995 | @@ -110,7 +110,7 @@ |
996 | Now, we are going to import a .po file that has a 'PO-Revision-Date' |
997 | field with a date older than a previous .po import. |
998 | |
999 | - >>> pofile_contents = r''' |
1000 | + >>> pofile_contents = br''' |
1001 | ... msgid "" |
1002 | ... msgstr "" |
1003 | ... "PO-Revision-Date: 2005-05-03 19:41+0100\n" |
1004 | @@ -142,14 +142,14 @@ |
1005 | >>> entry.status == RosettaImportStatus.FAILED |
1006 | True |
1007 | |
1008 | - >>> print entry.error_output |
1009 | + >>> print(entry.error_output) |
1010 | Outdated translation. The last imported version of this file was dated |
1011 | 2005-05-03 20:41:00+01:00; the timestamp in the file you uploaded is |
1012 | 2005-05-03 19:41:00+01:00. |
1013 | |
1014 | We can see that the header remains unchanged |
1015 | |
1016 | - >>> print pofile.header |
1017 | + >>> print(pofile.header) |
1018 | Project-Id-Version:... |
1019 | PO-Revision-Date: 2005-05-03 20:41+0100 |
1020 | ... |
1021 | @@ -158,7 +158,7 @@ |
1022 | |
1023 | >>> subject |
1024 | u'Import problem - Welsh (cy) - firefox in Mozilla Firefox trunk' |
1025 | - >>> print message |
1026 | + >>> print(message) |
1027 | Hello Mark Shuttleworth, |
1028 | <BLANKLINE> |
1029 | On ..., you uploaded a file with |
1030 | @@ -202,12 +202,12 @@ |
1031 | |
1032 | >>> entry.status == RosettaImportStatus.IMPORTED |
1033 | True |
1034 | - >>> print entry.error_output |
1035 | + >>> print(entry.error_output) |
1036 | None |
1037 | |
1038 | But the header remains unchanged, so that the older date is not recorded. |
1039 | |
1040 | - >>> print pofile.header |
1041 | + >>> print(pofile.header) |
1042 | Project-Id-Version:... |
1043 | PO-Revision-Date: 2005-05-03 20:41+0100 |
1044 | ... |
1045 | |
1046 | === modified file 'lib/lp/translations/doc/poimport-pofile-syntax-error.txt' |
1047 | --- lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2012-11-21 16:50:43 +0000 |
1048 | +++ lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2018-06-02 14:12:45 +0000 |
1049 | @@ -58,7 +58,7 @@ |
1050 | Let's import a .po file that misses the '"' char after msgstr. That's a |
1051 | syntax error. |
1052 | |
1053 | - >>> pofile_contents = r''' |
1054 | + >>> pofile_contents = br''' |
1055 | ... msgid "" |
1056 | ... msgstr "" |
1057 | ... "PO-Revision-Date: 2005-06-03 20:41+0100\n" |
1058 | @@ -84,10 +84,10 @@ |
1059 | The import fails. |
1060 | |
1061 | >>> (subject, message) = pofile.importFromQueue(entry) |
1062 | - >>> print entry.status.name |
1063 | + >>> print(entry.status.name) |
1064 | FAILED |
1065 | |
1066 | - >>> print entry.error_output |
1067 | + >>> print(entry.error_output) |
1068 | Line 12: String is not quoted |
1069 | |
1070 | And the code composed an email with the notification of the error. |
1071 | @@ -95,7 +95,7 @@ |
1072 | >>> subject |
1073 | u'Import problem - Welsh (cy) - firefox in Mozilla Firefox trunk' |
1074 | |
1075 | - >>> print message |
1076 | + >>> print(message) |
1077 | Hello Mark Shuttleworth, |
1078 | <BLANKLINE> |
1079 | On ..., you uploaded a file with Welsh (cy) translations for firefox in |
1080 | @@ -143,7 +143,7 @@ |
1081 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1082 | >>> transaction.commit() |
1083 | >>> (subject, message) = pofile.importFromQueue(entry) |
1084 | - >>> print entry.status.name |
1085 | + >>> print(entry.status.name) |
1086 | FAILED |
1087 | |
1088 | An email describes the problem in relatively helpful terms. |
1089 | @@ -151,7 +151,7 @@ |
1090 | >>> subject |
1091 | u'Import problem - Frisian (fy) - firefox in Mozilla Firefox trunk' |
1092 | |
1093 | - >>> print message |
1094 | + >>> print(message) |
1095 | Hello Mark Shuttleworth, |
1096 | <BLANKLINE> |
1097 | On ..., you uploaded a file with Frisian (fy) translations for |
1098 | @@ -175,7 +175,7 @@ |
1099 | |
1100 | The error output field is more terse. |
1101 | |
1102 | - >>> print entry.error_output |
1103 | + >>> print(entry.error_output) |
1104 | 'ascii' codec can't decode byte ... in position ...: ordinal not in |
1105 | range(128) |
1106 | |
1107 | @@ -194,7 +194,7 @@ |
1108 | submits a translation with a nonsensical plurals definition. |
1109 | |
1110 | >>> pofile = potemplate.newPOFile('sux') |
1111 | - >>> pofile_contents = r''' |
1112 | + >>> pofile_contents = br''' |
1113 | ... msgid "" |
1114 | ... msgstr "" |
1115 | ... "PO-Revision-Date: 2005-06-29 11:44+0100\n" |
1116 | @@ -215,13 +215,13 @@ |
1117 | |
1118 | The submission is rejected with a syntax error. |
1119 | |
1120 | - >>> print entry.status.name |
1121 | + >>> print(entry.status.name) |
1122 | FAILED |
1123 | |
1124 | >>> subject |
1125 | u'Import problem - Sumerian (sux) - firefox in Mozilla Firefox trunk' |
1126 | |
1127 | - >>> print message |
1128 | + >>> print(message) |
1129 | Hello Mark Shuttleworth, |
1130 | ... |
1131 | <BLANKLINE> |
1132 | @@ -238,7 +238,7 @@ |
1133 | Mark mistakenly attempts to import a translation with "zero" plural |
1134 | forms. He receives an email notifying him of a syntax error. |
1135 | |
1136 | - >>> pofile_contents = r''' |
1137 | + >>> pofile_contents = br''' |
1138 | ... msgid "" |
1139 | ... msgstr "" |
1140 | ... "PO-Revision-Date: 2005-06-14 18:33+0100\n" |
1141 | @@ -257,13 +257,13 @@ |
1142 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1143 | >>> (subject, message) = pofile.importFromQueue(entry) |
1144 | |
1145 | - >>> print entry.status.name |
1146 | + >>> print(entry.status.name) |
1147 | FAILED |
1148 | |
1149 | >>> subject |
1150 | u'Import problem - Sumerian (sux) - firefox in Mozilla Firefox trunk' |
1151 | |
1152 | - >>> print message |
1153 | + >>> print(message) |
1154 | Hello Mark Shuttleworth, |
1155 | ... |
1156 | <BLANKLINE> |
1157 | @@ -276,7 +276,7 @@ |
1158 | On his next attempt, Mark accidentally types a negative number of plural |
1159 | forms. The same error is given. |
1160 | |
1161 | - >>> pofile_contents = r''' |
1162 | + >>> pofile_contents = br''' |
1163 | ... msgid "" |
1164 | ... msgstr "" |
1165 | ... "PO-Revision-Date: 2005-06-15 19:04+0100\n" |
1166 | @@ -295,13 +295,13 @@ |
1167 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1168 | >>> (subject, message) = pofile.importFromQueue(entry) |
1169 | |
1170 | - >>> print entry.status.name |
1171 | + >>> print(entry.status.name) |
1172 | FAILED |
1173 | |
1174 | >>> subject |
1175 | u'Import problem - Sumerian (sux) - firefox in Mozilla Firefox trunk' |
1176 | |
1177 | - >>> print message |
1178 | + >>> print(message) |
1179 | Hello Mark Shuttleworth, |
1180 | ... |
1181 | We were unable to import the file because of errors in its format: |
1182 | @@ -325,7 +325,7 @@ |
1183 | >>> pofile = potemplate.newPOFile('ar') |
1184 | |
1185 | # PO file with nplurals=7, a value we can't handle. |
1186 | - >>> pofile_contents = r''' |
1187 | + >>> pofile_contents = br''' |
1188 | ... msgid "" |
1189 | ... msgstr "" |
1190 | ... "PO-Revision-Date: 2005-07-01 08:35+0100\n" |
1191 | @@ -351,13 +351,13 @@ |
1192 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1193 | >>> (subject, message) = pofile.importFromQueue(entry) |
1194 | |
1195 | - >>> print entry.status.name |
1196 | + >>> print(entry.status.name) |
1197 | FAILED |
1198 | |
1199 | >>> subject |
1200 | u'Import problem - Arabic (ar) - firefox in Mozilla Firefox trunk' |
1201 | |
1202 | - >>> print message |
1203 | + >>> print(message) |
1204 | Hello Mark Shuttleworth, |
1205 | <BLANKLINE> |
1206 | On ..., you uploaded a file with Arabic (ar) translations for firefox in |
1207 | @@ -389,7 +389,7 @@ |
1208 | plural forms, the file imports just fine. |
1209 | |
1210 | # Same PO file as before, but with nplurals=6. |
1211 | - >>> pofile_contents = r''' |
1212 | + >>> pofile_contents = br''' |
1213 | ... msgid "" |
1214 | ... msgstr "" |
1215 | ... "PO-Revision-Date: 2005-07-01 08:35+0100\n" |
1216 | @@ -414,7 +414,5 @@ |
1217 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1218 | >>> (subject, message) = pofile.importFromQueue(entry) |
1219 | |
1220 | - >>> print entry.status.name |
1221 | + >>> print(entry.status.name) |
1222 | IMPORTED |
1223 | - |
1224 | - |
1225 | |
1226 | === modified file 'lib/lp/translations/doc/poimport-potemplate-syntax-error.txt' |
1227 | --- lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2012-11-21 16:50:43 +0000 |
1228 | +++ lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2018-06-02 14:12:45 +0000 |
1229 | @@ -52,7 +52,7 @@ |
1230 | Let's import a .pot file that is missing its header. That's a |
1231 | TranslationFormatSyntaxError |
1232 | |
1233 | - >>> potemplate_contents = r''' |
1234 | + >>> potemplate_contents = br''' |
1235 | ... msgid "foo" |
1236 | ... msgstr "" |
1237 | ... ''' |
1238 | @@ -66,17 +66,17 @@ |
1239 | |
1240 | The import failed. |
1241 | |
1242 | - >>> print entry.status.name |
1243 | + >>> print(entry.status.name) |
1244 | FAILED |
1245 | |
1246 | - >>> print entry.error_output |
1247 | + >>> print(entry.error_output) |
1248 | No header found in this pofile |
1249 | |
1250 | And the code composed email with a notification of the error. |
1251 | |
1252 | >>> subject |
1253 | u'Import problem - firefox in Mozilla Firefox trunk' |
1254 | - >>> print message |
1255 | + >>> print(message) |
1256 | Hello Mark Shuttleworth, |
1257 | <BLANKLINE> |
1258 | On ..., you uploaded a file with translation templates for firefox in |
1259 | @@ -128,15 +128,15 @@ |
1260 | |
1261 | The import failed. |
1262 | |
1263 | - >>> print entry.status.name |
1264 | + >>> print(entry.status.name) |
1265 | FAILED |
1266 | |
1267 | The uploader receives an email about the encoding problem. |
1268 | |
1269 | - >>> print subject |
1270 | + >>> print(subject) |
1271 | Import problem - nonascii in Mozilla Firefox trunk |
1272 | |
1273 | - >>> print message |
1274 | + >>> print(message) |
1275 | Hello Mark Shuttleworth, |
1276 | <BLANKLINE> |
1277 | On ..., you uploaded a file with translation templates for nonascii |
1278 | @@ -160,6 +160,6 @@ |
1279 | The queue entry's error_output field also contains a brief |
1280 | description of the error. |
1281 | |
1282 | - >>> print entry.error_output |
1283 | + >>> print(entry.error_output) |
1284 | 'ascii' codec can't decode byte ... in position ...: ordinal not in |
1285 | range(128) |
1286 | |
1287 | === modified file 'lib/lp/translations/doc/poimport.txt' |
1288 | --- lib/lp/translations/doc/poimport.txt 2011-09-26 06:49:22 +0000 |
1289 | +++ lib/lp/translations/doc/poimport.txt 2018-06-02 14:12:45 +0000 |
1290 | @@ -56,7 +56,7 @@ |
1291 | |
1292 | This is the file that'll get imported. |
1293 | |
1294 | - >>> potemplate_contents = r''' |
1295 | + >>> potemplate_contents = br''' |
1296 | ... msgid "" |
1297 | ... msgstr "" |
1298 | ... "POT-Creation-Date: 2004-07-11 16:16+0900\n" |
1299 | @@ -125,7 +125,7 @@ |
1300 | |
1301 | Our request has now been serviced. |
1302 | |
1303 | - >>> print entry.status.name |
1304 | + >>> print(entry.status.name) |
1305 | IMPORTED |
1306 | |
1307 | The last update date is the one we got. |
1308 | @@ -135,12 +135,12 @@ |
1309 | |
1310 | We don't send mail about successful imports. |
1311 | |
1312 | - >>> print subject |
1313 | + >>> print(subject) |
1314 | None |
1315 | |
1316 | Since there was no error, the queue entry's error_output is blank. |
1317 | |
1318 | - >>> print entry.error_output |
1319 | + >>> print(entry.error_output) |
1320 | None |
1321 | |
1322 | The correct message IDs now show up in the template. |
1323 | @@ -195,7 +195,7 @@ |
1324 | |
1325 | By default, we got a safe path to prevent collisions with other IPOFile. |
1326 | |
1327 | - >>> print pofile.path |
1328 | + >>> print(pofile.path) |
1329 | unique-...-cy.po |
1330 | |
1331 | Let's override the default good path with one we know is the right one. |
1332 | @@ -220,7 +220,7 @@ |
1333 | Here are the contents of the file we'll be importing. It has some |
1334 | validation errors. |
1335 | |
1336 | - >>> pofile_with_errors = r''' |
1337 | + >>> pofile_with_errors = br''' |
1338 | ... msgid "" |
1339 | ... msgstr "" |
1340 | ... "PO-Revision-Date: 2005-06-03 19:41+0100\n" |
1341 | @@ -288,7 +288,7 @@ |
1342 | |
1343 | The status is now IMPORTED: |
1344 | |
1345 | - >>> print entry.status.name |
1346 | + >>> print(entry.status.name) |
1347 | IMPORTED |
1348 | |
1349 | Three translations have been properly imported. Note that the translation |
1350 | @@ -296,9 +296,9 @@ |
1351 | not appear in the POTemplate. |
1352 | |
1353 | >>> def show_translation_details(translationmessage, pofile): |
1354 | - ... print translationmessage.potmsgset.singular_text, |
1355 | - ... print translationmessage.translations, |
1356 | - ... print translationmessage.potmsgset.getSequence(pofile.potemplate) |
1357 | + ... print(translationmessage.potmsgset.singular_text, end=' ') |
1358 | + ... print(translationmessage.translations, end=' ') |
1359 | + ... print(translationmessage.potmsgset.getSequence(pofile.potemplate)) |
1360 | >>> for translationmessage in pofile.translation_messages: |
1361 | ... if translationmessage.is_current_ubuntu: |
1362 | ... show_translation_details(translationmessage, pofile) |
1363 | @@ -321,7 +321,7 @@ |
1364 | set in the PO template. |
1365 | |
1366 | >>> message = pofile.translation_messages[1] |
1367 | - >>> print message.potmsgset.singular_text |
1368 | + >>> print(message.potmsgset.singular_text) |
1369 | foo |
1370 | |
1371 | And should be accepted by our validator. |
1372 | @@ -339,7 +339,7 @@ |
1373 | ... pofile.potemplate, pofile.language, |
1374 | ... pofile.potemplate.translation_side) |
1375 | >>> message = get_pofile_translation_message(pofile, u'bar') |
1376 | - >>> print message |
1377 | + >>> print(message) |
1378 | None |
1379 | |
1380 | Check that the plural form was imported correctly. |
1381 | @@ -348,7 +348,7 @@ |
1382 | ... u'Singular %d', u'Plural %d') |
1383 | >>> imported_translationmessage = potmsgset.getOtherTranslation( |
1384 | ... pofile.language, pofile.potemplate.translation_side) |
1385 | - >>> print imported_translationmessage.validation_status.name |
1386 | + >>> print(imported_translationmessage.validation_status.name) |
1387 | OK |
1388 | |
1389 | >>> imported_translationmessage.translations |
1390 | @@ -365,10 +365,10 @@ |
1391 | doesn't send it out for published uploads (indicated with subject of |
1392 | None). |
1393 | |
1394 | - >>> print subject |
1395 | + >>> print(subject) |
1396 | None |
1397 | |
1398 | - >>> print body |
1399 | + >>> print(body) |
1400 | Hello Mark Shuttleworth, |
1401 | <BLANKLINE> |
1402 | On ..., you uploaded 5 |
1403 | @@ -391,7 +391,7 @@ |
1404 | The error information is also stored more compactly in the entry's |
1405 | error_output. |
1406 | |
1407 | - >>> print entry.error_output |
1408 | + >>> print(entry.error_output) |
1409 | Imported, but with errors: |
1410 | <BLANKLINE> |
1411 | 4. "format spec... 'msgid' and 'msgstr' for argument 1 are not the same": |
1412 | @@ -410,7 +410,7 @@ |
1413 | |
1414 | For example, here's a gettext PO file with two headers. |
1415 | |
1416 | - >>> pofile_with_warning = r''' |
1417 | + >>> pofile_with_warning = br''' |
1418 | ... msgid "" |
1419 | ... msgstr "" |
1420 | ... "Content-Type: text/plain; charset=UTF-8\n" |
1421 | @@ -441,7 +441,7 @@ |
1422 | number points at the next message. There's not much we can do about |
1423 | that, but it should help a bit. |
1424 | |
1425 | - >>> print message |
1426 | + >>> print(message) |
1427 | Hello ... |
1428 | This mail is to notify you that all translations have now been |
1429 | imported. |
1430 | @@ -456,7 +456,7 @@ |
1431 | <BLANKLINE> |
1432 | The Launchpad team |
1433 | |
1434 | - >>> print warning_entry.error_output |
1435 | + >>> print(warning_entry.error_output) |
1436 | There were warnings while parsing the file. These are not |
1437 | fatal, but please correct them if you can. |
1438 | <BLANKLINE> |
1439 | @@ -471,7 +471,7 @@ |
1440 | Now, let's import one without errors. This file changes one translation |
1441 | and adds another one. |
1442 | |
1443 | - >>> pofile_without_errors = r''' |
1444 | + >>> pofile_without_errors = br''' |
1445 | ... msgid "" |
1446 | ... msgstr "" |
1447 | ... "PO-Revision-Date: 2005-06-03 20:41+0100\n" |
1448 | @@ -498,7 +498,7 @@ |
1449 | |
1450 | The new upload clears the entry's error_output. |
1451 | |
1452 | - >>> print entry.error_output |
1453 | + >>> print(entry.error_output) |
1454 | None |
1455 | |
1456 | The guess IPOFile should be the same we already had. |
1457 | @@ -520,7 +520,7 @@ |
1458 | |
1459 | The status is now IMPORTED: |
1460 | |
1461 | - >>> print entry.status.name |
1462 | + >>> print(entry.status.name) |
1463 | IMPORTED |
1464 | |
1465 | Since the translations from the older imports are still present, |
1466 | @@ -543,17 +543,17 @@ |
1467 | that nothing is emailed out (subject is None) because this is an upstream |
1468 | upload. |
1469 | |
1470 | - >>> print subject |
1471 | + >>> print(subject) |
1472 | None |
1473 | |
1474 | - >>> print body |
1475 | + >>> print(body) |
1476 | Hello Rosetta Administrators, |
1477 | <BLANKLINE> |
1478 | ... |
1479 | |
1480 | There was no error output either. |
1481 | |
1482 | - >>> print entry.error_output |
1483 | + >>> print(entry.error_output) |
1484 | None |
1485 | |
1486 | The translation has been augmented with the strings from the imported |
1487 | @@ -621,7 +621,7 @@ |
1488 | plural forms). |
1489 | |
1490 | >>> language = factory.makeLanguage() |
1491 | - >>> print language.pluralforms |
1492 | + >>> print(language.pluralforms) |
1493 | None |
1494 | |
1495 | >>> potemplate = factory.makePOTemplate( |
1496 | @@ -632,7 +632,7 @@ |
1497 | |
1498 | We'll import a POFile with 3 plural forms into this POFile: |
1499 | |
1500 | - >>> pofile_with_plurals = r''' |
1501 | + >>> pofile_with_plurals = br''' |
1502 | ... msgid "" |
1503 | ... msgstr "" |
1504 | ... "PO-Revision-Date: 2005-06-03 19:41+0100\n" |
1505 | @@ -662,7 +662,7 @@ |
1506 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
1507 | >>> (subject, body) = pofile.importFromQueue(entry, FakeLogger()) |
1508 | >>> flush_database_updates() |
1509 | - >>> print entry.status.name |
1510 | + >>> print(entry.status.name) |
1511 | IMPORTED |
1512 | |
1513 | If we get a current translation for this PO file, it will list only two |
1514 | @@ -690,7 +690,7 @@ |
1515 | Add a maintainer POFile import (i.e. from a package or bzr branch), |
1516 | approve and import it. |
1517 | |
1518 | - >>> pofile_contents = r''' |
1519 | + >>> pofile_contents = br''' |
1520 | ... msgid "" |
1521 | ... msgstr "" |
1522 | ... "PO-Revision-Date: 2005-05-03 20:41+0100\n" |
1523 | @@ -717,7 +717,7 @@ |
1524 | >>> entry.status == RosettaImportStatus.IMPORTED |
1525 | True |
1526 | |
1527 | - >>> print subject |
1528 | + >>> print(subject) |
1529 | None |
1530 | |
1531 | For syntax errors, failure notification is still sent out. |
1532 | |
1533 | === modified file 'lib/lp/translations/doc/potemplate.txt' |
1534 | --- lib/lp/translations/doc/potemplate.txt 2014-01-30 09:58:18 +0000 |
1535 | +++ lib/lp/translations/doc/potemplate.txt 2018-06-02 14:12:45 +0000 |
1536 | @@ -70,7 +70,7 @@ |
1537 | >>> new_template = alsa_subset.new( |
1538 | ... 'testtemplate', 'testing', 'po/testing.pot', user) |
1539 | |
1540 | - >>> print new_template.header |
1541 | + >>> print(new_template.header) |
1542 | Project-Id-Version: PACKAGE VERSION |
1543 | Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS> |
1544 | POT-Creation-Date: ... |
1545 | @@ -95,7 +95,7 @@ |
1546 | |
1547 | >>> potemplate = potemplatesubset.getPOTemplateByName( |
1548 | ... 'evolution-2.2') |
1549 | - >>> print potemplate.title |
1550 | + >>> print(potemplate.title) |
1551 | Template "evolution-2.2" in Evolution trunk |
1552 | |
1553 | |
1554 | @@ -107,7 +107,7 @@ |
1555 | |
1556 | >>> potemplate = potemplatesubset.getPOTemplateByPath( |
1557 | ... 'po/evolution-2.2-test.pot') |
1558 | - >>> print potemplate.title |
1559 | + >>> print(potemplate.title) |
1560 | Template "evolution-2.2-test" in Evolution trunk |
1561 | |
1562 | |
1563 | @@ -140,7 +140,7 @@ |
1564 | ... productseries=productseries) |
1565 | |
1566 | >>> for template in potemplatesubset: |
1567 | - ... print template.path |
1568 | + ... print(template.path) |
1569 | po/evolution-2.2.pot |
1570 | po/evolution-2.2-test.pot |
1571 | |
1572 | @@ -154,7 +154,7 @@ |
1573 | ... productseries=productseries) |
1574 | |
1575 | >>> for template in potemplatesubset: |
1576 | - ... print template.path |
1577 | + ... print(template.path) |
1578 | po/netapplet.pot |
1579 | |
1580 | >>> potemplatesubset.getClosestPOTemplate('po') is None |
1581 | @@ -192,7 +192,7 @@ |
1582 | We can get an IPOFile inside a template based on its path. |
1583 | |
1584 | >>> pofile = potemplate.getPOFileByPath('es.po') |
1585 | - >>> print pofile.title |
1586 | + >>> print(pofile.title) |
1587 | Spanish (es) translation of evolution-2.2 in Evolution trunk |
1588 | |
1589 | |
1590 | @@ -206,7 +206,7 @@ |
1591 | >>> xx_language = factory.makeLanguage( |
1592 | ... 'xx@test', name='Test language') |
1593 | >>> xx_pofile = potemplate.getDummyPOFile(xx_language) |
1594 | - >>> print xx_pofile.title |
1595 | + >>> print(xx_pofile.title) |
1596 | Test language (xx@test) translation of evolution-2.2 in Evolution trunk |
1597 | |
1598 | |
1599 | @@ -249,13 +249,13 @@ |
1600 | |
1601 | >>> for relative_potemplate in potemplate.relatives_by_source: |
1602 | ... assert relative_potemplate.iscurrent |
1603 | - ... print relative_potemplate.title |
1604 | + ... print(relative_potemplate.title) |
1605 | Template "evolution-2.2-test" in Evolution trunk |
1606 | |
1607 | Let's get a new IPOTemplate that belongs to an IDistroSeries: |
1608 | |
1609 | >>> potemplate = POTemplate.get(4) |
1610 | - >>> print potemplate.title |
1611 | + >>> print(potemplate.title) |
1612 | Template "evolution-2.2" in Ubuntu Hoary package "evolution" |
1613 | |
1614 | And this is the list of templates related with this one based on its |
1615 | @@ -263,7 +263,7 @@ |
1616 | |
1617 | >>> for relative_potemplate in potemplate.relatives_by_source: |
1618 | ... assert relative_potemplate.iscurrent |
1619 | - ... print relative_potemplate.title |
1620 | + ... print(relative_potemplate.title) |
1621 | Template "man" in Ubuntu Hoary package "evolution" |
1622 | |
1623 | But we can see that there is a third template in this context: |
1624 | @@ -294,7 +294,7 @@ |
1625 | ... if 'X-Launchpad-Export-Date' in line: |
1626 | ... # Avoid a time bomb in our tests and ignore this field. |
1627 | ... continue |
1628 | - ... print line |
1629 | + ... print(line) |
1630 | #, fuzzy |
1631 | msgid "" |
1632 | msgstr "" |
1633 | @@ -569,7 +569,7 @@ |
1634 | In this case, we are going to see how a PO template is exported with |
1635 | translations. |
1636 | |
1637 | - >>> print potemplate.source_file_format.name |
1638 | + >>> print(potemplate.source_file_format.name) |
1639 | PO |
1640 | |
1641 | >>> exported_translation_file = potemplate.exportWithTranslations() |
1642 | @@ -577,7 +577,7 @@ |
1643 | PO file format doesn't have a native way to export template + |
1644 | translations, instead, we get a tarball with all those files. |
1645 | |
1646 | - >>> print exported_translation_file.content_type |
1647 | + >>> print(exported_translation_file.content_type) |
1648 | application/x-gtar |
1649 | |
1650 | Inspecting the tarball content, we have the list of entries exported. |
1651 | @@ -606,7 +606,7 @@ |
1652 | >>> from lp.services.helpers import simple_popen2 |
1653 | >>> contents = simple_popen2(['tar', 'ztf', '-'], tarfile_string) |
1654 | >>> for line in sorted(contents.splitlines()): |
1655 | - ... print line |
1656 | + ... print(line) |
1657 | evolution-2.2/ |
1658 | evolution-2.2/evolution-2.2-es.po |
1659 | evolution-2.2/evolution-2.2-ja.po |
1660 | @@ -618,6 +618,5 @@ |
1661 | >>> pofile = simple_popen2( |
1662 | ... ['tar', 'zxfO', '-', 'evolution-2.2/evolution-2.2-es.po'], |
1663 | ... tarfile_string) |
1664 | - >>> pofile.split('\n')[0] |
1665 | + >>> pofile.split(b'\n')[0] |
1666 | '# traducci\xc3\xb3n de es.po al Spanish' |
1667 | - |
1668 | |
1669 | === modified file 'lib/lp/translations/doc/potmsgset.txt' |
1670 | --- lib/lp/translations/doc/potmsgset.txt 2012-12-26 01:32:19 +0000 |
1671 | +++ lib/lp/translations/doc/potmsgset.txt 2018-06-02 14:12:45 +0000 |
1672 | @@ -44,16 +44,16 @@ |
1673 | is_translation_credit indicates if the POTMsgSet is translation credits. The |
1674 | property translation_credit_type contains the type of translation credits. |
1675 | |
1676 | - >>> print potmsgset.is_translation_credit |
1677 | + >>> print(potmsgset.is_translation_credit) |
1678 | False |
1679 | - >>> print potmsgset.translation_credits_type.title |
1680 | + >>> print(potmsgset.translation_credits_type.title) |
1681 | Not a translation credits message |
1682 | |
1683 | >>> credits = factory.makePOTMsgSet( |
1684 | ... potemplate, singular=u'translator-credits') |
1685 | - >>> print credits.is_translation_credit |
1686 | + >>> print(credits.is_translation_credit) |
1687 | True |
1688 | - >>> print credits.translation_credits_type.title |
1689 | + >>> print(credits.translation_credits_type.title) |
1690 | Gnome credits message |
1691 | |
1692 | |
1693 | @@ -83,7 +83,7 @@ |
1694 | >>> current = potmsgset.getCurrentTranslation( |
1695 | ... evolution_potemplate, pt_BR_dummypofile.language, |
1696 | ... evolution_potemplate.translation_side) |
1697 | - >>> print current |
1698 | + >>> print(current) |
1699 | None |
1700 | >>> pt_BR_dummy_current = potmsgset.getCurrentTranslationMessageOrDummy( |
1701 | ... pt_BR_dummypofile) |
1702 | @@ -94,7 +94,7 @@ |
1703 | |
1704 | A TranslationMessage knows what language it is in. |
1705 | |
1706 | - >>> print pt_BR_dummy_current.language.code |
1707 | + >>> print(pt_BR_dummy_current.language.code) |
1708 | pt_BR |
1709 | |
1710 | Using another dummy pofile we'll get a POTMsgset that's not a singular |
1711 | @@ -104,13 +104,13 @@ |
1712 | >>> apa_dummypofile = evolution_potemplate.getDummyPOFile(language_apa) |
1713 | >>> plural_potmsgset = apa_dummypofile.potemplate.getPOTMsgSetByMsgIDText( |
1714 | ... u'%d contact', u'%d contacts') |
1715 | - >>> print apa_dummypofile.language.code |
1716 | + >>> print(apa_dummypofile.language.code) |
1717 | apa |
1718 | |
1719 | We don't know anything about pluralforms for this language, so we fall |
1720 | back to the most common case: |
1721 | |
1722 | - >>> print apa_dummypofile.language.pluralforms |
1723 | + >>> print(apa_dummypofile.language.pluralforms) |
1724 | None |
1725 | >>> apa_dummy_current = ( |
1726 | ... plural_potmsgset.getCurrentTranslationMessageOrDummy( |
1727 | @@ -128,7 +128,7 @@ |
1728 | ... plural_potmsgset.getCurrentTranslationMessageOrDummy( |
1729 | ... ru_dummypofile)) |
1730 | |
1731 | - >>> print ru_dummypofile.language.pluralforms |
1732 | + >>> print(ru_dummypofile.language.pluralforms) |
1733 | 3 |
1734 | >>> ru_dummy_current.plural_forms |
1735 | 3 |
1736 | @@ -179,9 +179,9 @@ |
1737 | The number of plural forms in the Zapotec language is not configured, |
1738 | so for now, the system guesses that it has two. |
1739 | |
1740 | - >>> print zap.pluralforms |
1741 | + >>> print(zap.pluralforms) |
1742 | None |
1743 | - >>> print pm_translation.plural_forms |
1744 | + >>> print(pm_translation.plural_forms) |
1745 | 2 |
1746 | |
1747 | >>> pm_template = pm_translation.potemplate |
1748 | @@ -294,7 +294,7 @@ |
1749 | ... suggestion.translations[0], |
1750 | ... ' & '.join(usage))) |
1751 | ... for line in sorted(lines): |
1752 | - ... print line |
1753 | + ... print(line) |
1754 | |
1755 | |
1756 | POTMsgSet.getExternallyUsedTranslationMessages |
1757 | @@ -303,7 +303,7 @@ |
1758 | On one side, we have a translation template for the evolution product. |
1759 | |
1760 | >>> evo_product_template = evolution_potemplate |
1761 | - >>> print evo_product_template.title |
1762 | + >>> print(evo_product_template.title) |
1763 | Template "evolution-2.2" in Evolution trunk |
1764 | |
1765 | On the other, we have a translation template for the evolution package in |
1766 | @@ -316,7 +316,7 @@ |
1767 | >>> evo_distro_template = templateset.getSubset( |
1768 | ... sourcepackagename=evo_hoary_package.sourcepackagename, |
1769 | ... distroseries=ubuntu_hoary).getPOTemplateByName('evolution-2.2') |
1770 | - >>> print evo_distro_template.title |
1771 | + >>> print(evo_distro_template.title) |
1772 | Template "evolution-2.2" in Ubuntu Hoary package "evolution" |
1773 | |
1774 | Both, product and distribution use Launchpad Translations. |
1775 | @@ -446,12 +446,12 @@ |
1776 | >>> potmsgset_translated = evo_man_template.getPOTMsgSetByMsgIDText( |
1777 | ... 'test man page') |
1778 | >>> pofile = evo_man_template.getPOFileByLang('es') |
1779 | - >>> print pofile.title |
1780 | + >>> print(pofile.title) |
1781 | Spanish (es) translation of man in Ubuntu Hoary package "evolution" |
1782 | >>> current = potmsgset_translated.getCurrentTranslation( |
1783 | ... evo_man_template, pofile.language, |
1784 | ... evo_man_template.translation_side) |
1785 | - >>> print current.translations |
1786 | + >>> print(current.translations) |
1787 | [u'just a translation'] |
1788 | |
1789 | It doesn't return other submissions done in the given IPOMsgSet because |
1790 | @@ -479,7 +479,7 @@ |
1791 | ... 'test man page') |
1792 | >>> language_es = getUtility(ILanguageSet).getLanguageByCode('es') |
1793 | >>> pofile = pmount_man_template.getDummyPOFile(language_es) |
1794 | - >>> print pofile.title |
1795 | + >>> print(pofile.title) |
1796 | Spanish (es) translation of man in Ubuntu Hoary package "pmount" |
1797 | |
1798 | Given that it doesn't exist in our database, is impossible to have a |
1799 | @@ -488,11 +488,11 @@ |
1800 | >>> current = potmsgset_untranslated.getCurrentTranslation( |
1801 | ... pmount_man_template, pofile.language, |
1802 | ... pmount_man_template.translation_side) |
1803 | - >>> print current |
1804 | + >>> print(current) |
1805 | None |
1806 | >>> imported = potmsgset_untranslated.getOtherTranslation( |
1807 | ... pofile.language, pmount_man_template.translation_side) |
1808 | - >>> print imported |
1809 | + >>> print(imported) |
1810 | None |
1811 | |
1812 | This other dummy IPOMsgSet though, will get all submissions done in |
1813 | @@ -674,8 +674,8 @@ |
1814 | |
1815 | >>> def print_flags(potmsgset): |
1816 | ... for flag in sorted(potmsgset.flags): |
1817 | - ... print '"%s"' % flag |
1818 | - ... print '.' |
1819 | + ... print('"%s"' % flag) |
1820 | + ... print('.') |
1821 | |
1822 | >>> print_flags(flagged_potmsgset) |
1823 | "c-format" |
1824 | @@ -686,4 +686,3 @@ |
1825 | |
1826 | >>> print_flags(POTMsgSet()) |
1827 | . |
1828 | - |
1829 | |
1830 | === modified file 'lib/lp/translations/doc/potranslation.txt' |
1831 | --- lib/lp/translations/doc/potranslation.txt 2009-07-02 17:16:50 +0000 |
1832 | +++ lib/lp/translations/doc/potranslation.txt 2018-06-02 14:12:45 +0000 |
1833 | @@ -34,11 +34,10 @@ |
1834 | If you want to pass non-ascii characters to either of these, it had better be |
1835 | either UTF-8 string or, better, a unicode object. |
1836 | |
1837 | - >>> got = POTranslation.getOrCreateTranslation('\xc3\x81') |
1838 | + >>> got = POTranslation.getOrCreateTranslation(b'\xc3\x81') |
1839 | >>> got = POTranslation.getOrCreateTranslation(u'\u00c2') |
1840 | |
1841 | - >>> got = POTranslation.getOrCreateTranslation('\xc0') |
1842 | + >>> got = POTranslation.getOrCreateTranslation(b'\xc0') |
1843 | Traceback (most recent call last): |
1844 | ... |
1845 | UnicodeDecodeError: 'utf8' codec can't decode byte 0xc0 in position... |
1846 | - |
1847 | |
1848 | === modified file 'lib/lp/translations/doc/remove-translations-by.txt' |
1849 | --- lib/lp/translations/doc/remove-translations-by.txt 2011-12-23 16:39:35 +0000 |
1850 | +++ lib/lp/translations/doc/remove-translations-by.txt 2018-06-02 14:12:45 +0000 |
1851 | @@ -28,7 +28,7 @@ |
1852 | ... for message in pofile.translation_messages |
1853 | ... if message.msgstr0 is not None) |
1854 | ... for item in contents: |
1855 | - ... print item |
1856 | + ... print(item) |
1857 | |
1858 | |
1859 | == Running the script== |
1860 | @@ -56,7 +56,7 @@ |
1861 | True |
1862 | >>> nl_message.is_current_ubuntu |
1863 | False |
1864 | - >>> print nl_message.potmsgset.msgid_singular.msgid |
1865 | + >>> print(nl_message.potmsgset.msgid_singular.msgid) |
1866 | My goose is undercooked. |
1867 | >>> nl_message.origin == RosettaTranslationOrigin.ROSETTAWEB |
1868 | True |
1869 | @@ -106,7 +106,7 @@ |
1870 | The long list of matching options we gave above indicated exactly 1 |
1871 | message. |
1872 | |
1873 | - >>> print err |
1874 | + >>> print(err) |
1875 | WARNING Deleting messages currently in use: |
1876 | WARNING Message ... is a current translation in upstream |
1877 | DEBUG Sample of messages to be deleted follows. |
1878 | @@ -149,7 +149,7 @@ |
1879 | >>> out |
1880 | '' |
1881 | |
1882 | - >>> print err |
1883 | + >>> print(err) |
1884 | WARNING Safety override in effect. Deleting translations for template ... |
1885 | INFO Dry run only. Not really deleting. |
1886 | WARNING Deleting messages currently in use: |
1887 | |
1888 | === modified file 'lib/lp/translations/doc/rosetta-karma.txt' |
1889 | --- lib/lp/translations/doc/rosetta-karma.txt 2016-01-26 15:47:37 +0000 |
1890 | +++ lib/lp/translations/doc/rosetta-karma.txt 2018-06-02 14:12:45 +0000 |
1891 | @@ -37,7 +37,7 @@ |
1892 | |
1893 | Let's say that we have this .pot file to import: |
1894 | |
1895 | - >>> potemplate_contents = r''' |
1896 | + >>> potemplate_contents = br''' |
1897 | ... msgid "" |
1898 | ... msgstr "" |
1899 | ... "Content-Type: text/plain; charset=CHARSET\n" |
1900 | @@ -121,7 +121,7 @@ |
1901 | >>> import datetime |
1902 | >>> import pytz |
1903 | >>> UTC = pytz.timezone('UTC') |
1904 | - >>> pofile_contents = r''' |
1905 | + >>> pofile_contents = br''' |
1906 | ... msgid "" |
1907 | ... msgstr "" |
1908 | ... "Content-Type: text/plain; charset=UTF-8\n" |
1909 | @@ -193,7 +193,7 @@ |
1910 | Now, the user is going to upload a local edition of the .po file. In this |
1911 | case, we will give karma *only* because the translation change. |
1912 | |
1913 | - >>> pofile_contents = r''' |
1914 | + >>> pofile_contents = br''' |
1915 | ... msgid "" |
1916 | ... msgstr "" |
1917 | ... "Content-Type: text/plain; charset=UTF-8\n" |
1918 | |
1919 | === modified file 'lib/lp/translations/doc/rosetta-poimport-script.txt' |
1920 | --- lib/lp/translations/doc/rosetta-poimport-script.txt 2012-06-14 20:21:38 +0000 |
1921 | +++ lib/lp/translations/doc/rosetta-poimport-script.txt 2018-06-02 14:12:45 +0000 |
1922 | @@ -28,11 +28,11 @@ |
1923 | Provide a POFile with Last-Translator set to a user not existing in |
1924 | the sampledata. |
1925 | |
1926 | - >>> print getUtility(IPersonSet).getByEmail('danilo@canonical.com') |
1927 | + >>> print(getUtility(IPersonSet).getByEmail('danilo@canonical.com')) |
1928 | None |
1929 | |
1930 | >>> pofile = potemplate.newPOFile('sr') |
1931 | - >>> pofile_content = r''' |
1932 | + >>> pofile_content = br''' |
1933 | ... msgid "" |
1934 | ... msgstr "" |
1935 | ... "PO-Revision-Date: 2005-06-04 20:41+0100\n" |
1936 | @@ -88,7 +88,7 @@ |
1937 | >>> stdout, stderr = process.communicate() |
1938 | >>> process.returncode |
1939 | 0 |
1940 | - >>> print stderr |
1941 | + >>> print(stderr) |
1942 | INFO Creating lockfile: /var/lock/launchpad-rosetta-poimport.lock |
1943 | INFO Importing: Serbian (sr) ... of evolution-2.2 in Evolution trunk |
1944 | INFO Import requests completed. |
1945 | @@ -101,4 +101,3 @@ |
1946 | ... filter_status=False) |
1947 | >>> danilo.displayname |
1948 | u'Danilo \u0160egan' |
1949 | - |
1950 | |
1951 | === modified file 'lib/lp/translations/doc/sourcepackagerelease-translations.txt' |
1952 | --- lib/lp/translations/doc/sourcepackagerelease-translations.txt 2014-04-24 08:21:42 +0000 |
1953 | +++ lib/lp/translations/doc/sourcepackagerelease-translations.txt 2018-06-02 14:12:45 +0000 |
1954 | @@ -43,7 +43,7 @@ |
1955 | >>> spr_test = SourcePackageRelease.get(20) |
1956 | >>> sp_test = spr_test.upload_distroseries.getSourcePackage( |
1957 | ... spr_test.sourcepackagename) |
1958 | - >>> print spr_test.title |
1959 | + >>> print(spr_test.title) |
1960 | pmount - 0.1-1 |
1961 | |
1962 | >>> from lp.soyuz.interfaces.packagetranslationsuploadjob import ( |
1963 | @@ -86,7 +86,7 @@ |
1964 | 2 |
1965 | |
1966 | >>> for entry in queue_entries: |
1967 | - ... print entry.path, entry.importer.name |
1968 | + ... print(entry.path, entry.importer.name) |
1969 | something/en-US.xpi maria |
1970 | po/es.po maria |
1971 | |
1972 | @@ -105,7 +105,7 @@ |
1973 | ... stderr=subprocess.STDOUT |
1974 | ... ) |
1975 | >>> (output, empty) = process.communicate() |
1976 | - >>> print output |
1977 | + >>> print(output) |
1978 | INFO Creating lockfile: |
1979 | /var/lock/launchpad-translations-import-queue-gardener.lock |
1980 | INFO The automatic approval system approved some entries. |
1981 | @@ -121,7 +121,7 @@ |
1982 | ... stderr=subprocess.STDOUT |
1983 | ... ) |
1984 | >>> (output, empty) = process.communicate() |
1985 | - >>> print output |
1986 | + >>> print(output) |
1987 | INFO Creating lockfile: /var/lock/launchpad-rosetta-poimport.lock |
1988 | INFO Importing: Spanish (es) translation of pmount in Ubuntu Hoary |
1989 | package "pmount" |
1990 | @@ -139,51 +139,49 @@ |
1991 | |
1992 | Anything not in the "source/" directory is ignored. |
1993 | |
1994 | - >>> print _filter_ubuntu_translation_file('foo/bar.po') |
1995 | + >>> print(_filter_ubuntu_translation_file('foo/bar.po')) |
1996 | None |
1997 | |
1998 | Files in source/ have that directory stripped off. |
1999 | |
2000 | - >>> print _filter_ubuntu_translation_file('source/bar.po') |
2001 | + >>> print(_filter_ubuntu_translation_file('source/bar.po')) |
2002 | bar.po |
2003 | |
2004 | Files in source/debian/po/* and a few other paths are ignored. |
2005 | |
2006 | Ones in debian/po are generally debconf translations, unused in Ubuntu. |
2007 | |
2008 | - >>> print _filter_ubuntu_translation_file('source/debian/po/bar.po') |
2009 | + >>> print(_filter_ubuntu_translation_file('source/debian/po/bar.po')) |
2010 | None |
2011 | |
2012 | Ones in d-i are Debian Installer translations. Ubuntu builds those |
2013 | translations very differently from how Debian does it, so we don't need |
2014 | these uploads. |
2015 | |
2016 | - >>> print _filter_ubuntu_translation_file('source/d-i/foo.po') |
2017 | + >>> print(_filter_ubuntu_translation_file('source/d-i/foo.po')) |
2018 | None |
2019 | |
2020 | Then there are some documentation directories whose contents we can't |
2021 | translate in Launchpad. |
2022 | |
2023 | - >>> print _filter_ubuntu_translation_file('source/help/xx.pot') |
2024 | - None |
2025 | - |
2026 | - >>> print _filter_ubuntu_translation_file('source/man/po/yy.po') |
2027 | - None |
2028 | - |
2029 | - >>> print _filter_ubuntu_translation_file('source/man/po4a/zz.pot') |
2030 | + >>> print(_filter_ubuntu_translation_file('source/help/xx.pot')) |
2031 | + None |
2032 | + |
2033 | + >>> print(_filter_ubuntu_translation_file('source/man/po/yy.po')) |
2034 | + None |
2035 | + |
2036 | + >>> print(_filter_ubuntu_translation_file('source/man/po4a/zz.pot')) |
2037 | None |
2038 | |
2039 | The match is on a path component boundary, so we don't filter other |
2040 | uploads whose paths happen to begin with the same words as a directory |
2041 | we filter. |
2042 | |
2043 | - >>> print _filter_ubuntu_translation_file('source/debian/pool.pot') |
2044 | + >>> print(_filter_ubuntu_translation_file('source/debian/pool.pot')) |
2045 | debian/pool.pot |
2046 | |
2047 | - >>> print _filter_ubuntu_translation_file('source/d-input.pot') |
2048 | + >>> print(_filter_ubuntu_translation_file('source/d-input.pot')) |
2049 | d-input.pot |
2050 | |
2051 | - >>> print _filter_ubuntu_translation_file('source/man/positive/nl.po') |
2052 | + >>> print(_filter_ubuntu_translation_file('source/man/positive/nl.po')) |
2053 | man/positive/nl.po |
2054 | - |
2055 | - |
2056 | |
2057 | === modified file 'lib/lp/translations/doc/translationbranchapprover.txt' |
2058 | --- lib/lp/translations/doc/translationbranchapprover.txt 2016-01-26 15:47:37 +0000 |
2059 | +++ lib/lp/translations/doc/translationbranchapprover.txt 2018-06-02 14:12:45 +0000 |
2060 | @@ -62,7 +62,7 @@ |
2061 | >>> from lp.translations.interfaces.translationimportqueue import ( |
2062 | ... ITranslationImportQueue) |
2063 | >>> queue = getUtility(ITranslationImportQueue) |
2064 | - >>> entry = queue.addOrUpdateEntry("foo.pot", "foo pot content", True, |
2065 | + >>> entry = queue.addOrUpdateEntry("foo.pot", b"foo pot content", True, |
2066 | ... series.owner, productseries=series) |
2067 | |
2068 | The job initializes the approver with the list of template files in the tree, |
2069 | @@ -73,15 +73,15 @@ |
2070 | |
2071 | It approves the entry which leads to the creation of a new POTemplate object. |
2072 | |
2073 | - >>> print entry.potemplate |
2074 | + >>> print(entry.potemplate) |
2075 | None |
2076 | >>> entry = approver.approve(entry) |
2077 | - >>> print repr(entry.potemplate) |
2078 | + >>> print(repr(entry.potemplate)) |
2079 | <POTemplate at ...> |
2080 | >>> foo_potemplate = entry.potemplate |
2081 | - >>> print foo_potemplate.name |
2082 | + >>> print(foo_potemplate.name) |
2083 | foo |
2084 | - >>> print repr(entry.status) |
2085 | + >>> print(repr(entry.status)) |
2086 | <DBItem RosettaImportStatus.APPROVED, (1) Approved> |
2087 | |
2088 | Now the project owner wants to use two translation domains in their project |
2089 | @@ -89,7 +89,7 @@ |
2090 | detects this new file on its next run and places it into the import queue |
2091 | (but not the first one which is left unchanged). |
2092 | |
2093 | - >>> entry = queue.addOrUpdateEntry("bar.pot", "bar pot content", True, |
2094 | + >>> entry = queue.addOrUpdateEntry("bar.pot", b"bar pot content", True, |
2095 | ... series.owner, productseries=series) |
2096 | |
2097 | The job does know about all the template files in the tree and so it |
2098 | @@ -101,15 +101,15 @@ |
2099 | It approves the entry which leads to the creation of another POTemplate |
2100 | object. |
2101 | |
2102 | - >>> print entry.potemplate |
2103 | + >>> print(entry.potemplate) |
2104 | None |
2105 | >>> entry = approver.approve(entry) |
2106 | - >>> print repr(entry.potemplate) |
2107 | + >>> print(repr(entry.potemplate)) |
2108 | <POTemplate at ...> |
2109 | >>> bar_potemplate = entry.potemplate |
2110 | - >>> print bar_potemplate.name |
2111 | + >>> print(bar_potemplate.name) |
2112 | bar |
2113 | - >>> print repr(entry.status) |
2114 | + >>> print(repr(entry.status)) |
2115 | <DBItem RosettaImportStatus.APPROVED, (1) Approved> |
2116 | |
2117 | |
2118 | @@ -120,9 +120,9 @@ |
2119 | upload job detects two changed files and places them in the upload queue. |
2120 | |
2121 | >>> foo_entry = queue.addOrUpdateEntry("po/foo/messages.pot", |
2122 | - ... "foo pot content", True, series.owner, productseries=series) |
2123 | + ... b"foo pot content", True, series.owner, productseries=series) |
2124 | >>> bar_entry = queue.addOrUpdateEntry("po/bar/messages.pot", |
2125 | - ... "bar pot content", True, series.owner, productseries=series) |
2126 | + ... b"bar pot content", True, series.owner, productseries=series) |
2127 | |
2128 | Since these two files are all the translation template files in the tree, |
2129 | the job initializes the approver with their names. This is situation 1. |
2130 | @@ -135,18 +135,18 @@ |
2131 | attributes of the linked objects are updated. |
2132 | |
2133 | >>> foo_entry = approver.approve(foo_entry) |
2134 | - >>> print foo_entry.potemplate == foo_potemplate |
2135 | + >>> print(foo_entry.potemplate == foo_potemplate) |
2136 | True |
2137 | - >>> print foo_potemplate.path |
2138 | + >>> print(foo_potemplate.path) |
2139 | po/foo/messages.pot |
2140 | - >>> print repr(foo_entry.status) |
2141 | + >>> print(repr(foo_entry.status)) |
2142 | <DBItem RosettaImportStatus.APPROVED, (1) Approved> |
2143 | >>> bar_entry = approver.approve(bar_entry) |
2144 | - >>> print bar_entry.potemplate == bar_potemplate |
2145 | + >>> print(bar_entry.potemplate == bar_potemplate) |
2146 | True |
2147 | - >>> print bar_potemplate.path |
2148 | + >>> print(bar_potemplate.path) |
2149 | po/bar/messages.pot |
2150 | - >>> print repr(bar_entry.status) |
2151 | + >>> print(repr(bar_entry.status)) |
2152 | <DBItem RosettaImportStatus.APPROVED, (1) Approved> |
2153 | |
2154 | But now the branch owner messes things up and renames the bar template |
2155 | @@ -154,7 +154,7 @@ |
2156 | queue. |
2157 | |
2158 | >>> spam_entry = queue.addOrUpdateEntry("po/spam/messages.pot", |
2159 | - ... "bar pot content", True, series.owner, productseries=series) |
2160 | + ... b"bar pot content", True, series.owner, productseries=series) |
2161 | |
2162 | Since these two files are again all the translation template files in the |
2163 | tree, the job initializes the approver with their names. But this is |
2164 | @@ -170,21 +170,20 @@ |
2165 | each other. |
2166 | |
2167 | >>> spam_entry = approver.approve(spam_entry) |
2168 | - >>> print spam_entry.potemplate |
2169 | + >>> print(spam_entry.potemplate) |
2170 | None |
2171 | - >>> print repr(spam_entry.status) |
2172 | + >>> print(repr(spam_entry.status)) |
2173 | <DBItem RosettaImportStatus.NEEDS_REVIEW, (5) Needs Review> |
2174 | |
2175 | It is however still possible to update the foo template as this can be matched |
2176 | safely against the existing foo_template object, even in situation 3. |
2177 | |
2178 | >>> foo_entry = queue.addOrUpdateEntry("po/foo/messages.pot", |
2179 | - ... "CHANGED foo pot content", True, |
2180 | + ... b"CHANGED foo pot content", True, |
2181 | ... series.owner, productseries=series) |
2182 | >>> approver = TranslationBranchApprover( |
2183 | ... ['po/foo/messages.pot', 'po/spam/messages.pot'], |
2184 | ... productseries=series) |
2185 | >>> foo_entry = approver.approve(foo_entry) |
2186 | - >>> print repr(foo_entry.status) |
2187 | + >>> print(repr(foo_entry.status)) |
2188 | <DBItem RosettaImportStatus.APPROVED, (1) Approved> |
2189 | - |
2190 | |
2191 | === modified file 'lib/lp/translations/doc/translationbuildapprover.txt' |
2192 | --- lib/lp/translations/doc/translationbuildapprover.txt 2014-01-30 15:04:06 +0000 |
2193 | +++ lib/lp/translations/doc/translationbuildapprover.txt 2018-06-02 14:12:45 +0000 |
2194 | @@ -14,7 +14,7 @@ |
2195 | >>> from lp.translations.model.approver import TranslationBuildApprover |
2196 | >>> def makeQueueEntry(path, series): |
2197 | ... return queue.addOrUpdateEntry( |
2198 | - ... path, "#Dummy content.", False, importer_person, |
2199 | + ... path, b"#Dummy content.", False, importer_person, |
2200 | ... productseries=series) |
2201 | >>> login("foo.bar@canonical.com") |
2202 | |
2203 | @@ -25,10 +25,10 @@ |
2204 | >>> approver = TranslationBuildApprover( |
2205 | ... ["po/my_domain.pot"], productseries=productseries) |
2206 | >>> entry = makeQueueEntry("po/my_domain.pot", productseries) |
2207 | - >>> print entry.status.title |
2208 | + >>> print(entry.status.title) |
2209 | Needs Review |
2210 | >>> entry = approver.approve(entry) |
2211 | - >>> print entry.status.title |
2212 | + >>> print(entry.status.title) |
2213 | Approved |
2214 | |
2215 | If a template with the name exists, it will target the import entry to it and |
2216 | @@ -42,9 +42,9 @@ |
2217 | >>> entry = makeQueueEntry( |
2218 | ... "po/existing_domain.pot", productseries) |
2219 | >>> entry = approver.approve(entry) |
2220 | - >>> print entry.status.title |
2221 | + >>> print(entry.status.title) |
2222 | Approved |
2223 | - >>> print entry.potemplate == existing_potemplate |
2224 | + >>> print(entry.potemplate == existing_potemplate) |
2225 | True |
2226 | |
2227 | A template file with generic names is only approved if it is the only one that |
2228 | @@ -57,11 +57,11 @@ |
2229 | >>> approver = TranslationBuildApprover( |
2230 | ... ['po/messages.pot'], productseries=productseries) |
2231 | >>> generic_entry = approver.approve(generic_entry) |
2232 | - >>> print generic_entry.status.title |
2233 | + >>> print(generic_entry.status.title) |
2234 | Approved |
2235 | - >>> print generic_entry.potemplate.translation_domain |
2236 | + >>> print(generic_entry.potemplate.translation_domain) |
2237 | fooproduct |
2238 | - >>> print generic_entry.potemplate.name |
2239 | + >>> print(generic_entry.potemplate.name) |
2240 | fooproduct |
2241 | |
2242 | If there are other files or templates, files with generic names are not |
2243 | @@ -73,10 +73,9 @@ |
2244 | ... productseries=productseries) |
2245 | >>> generic_entry = makeQueueEntry("po/messages.pot", productseries) |
2246 | >>> generic_entry = approver.approve(generic_entry) |
2247 | - >>> print generic_entry.status.title |
2248 | + >>> print(generic_entry.status.title) |
2249 | Needs Review |
2250 | >>> valid_entry = makeQueueEntry("validdomain.pot", productseries) |
2251 | >>> valid_entry = approver.approve(valid_entry) |
2252 | - >>> print valid_entry.status.title |
2253 | + >>> print(valid_entry.status.title) |
2254 | Approved |
2255 | - |
2256 | |
2257 | === modified file 'lib/lp/translations/doc/translationgroup.txt' |
2258 | --- lib/lp/translations/doc/translationgroup.txt 2016-01-26 15:47:37 +0000 |
2259 | +++ lib/lp/translations/doc/translationgroup.txt 2018-06-02 14:12:45 +0000 |
2260 | @@ -134,26 +134,26 @@ |
2261 | is a part of: |
2262 | |
2263 | >>> for group in translation_group_set.getByPerson(carlos): |
2264 | - ... print group.name |
2265 | + ... print(group.name) |
2266 | testing-translation-team |
2267 | |
2268 | >>> for group in translation_group_set.getByPerson(no_priv): |
2269 | - ... print group.name |
2270 | + ... print(group.name) |
2271 | foo-translators |
2272 | |
2273 | >>> translators = getUtility(ITranslatorSet) |
2274 | >>> for trans in translators.getByTranslator(carlos): |
2275 | - ... print trans.language.code |
2276 | - ... print trans.translationgroup.name |
2277 | - ... print trans.style_guide_url |
2278 | + ... print(trans.language.code) |
2279 | + ... print(trans.translationgroup.name) |
2280 | + ... print(trans.style_guide_url) |
2281 | es |
2282 | testing-translation-team |
2283 | None |
2284 | |
2285 | >>> for trans in translators.getByTranslator(no_priv): |
2286 | - ... print trans.language.code |
2287 | - ... print trans.translationgroup.name |
2288 | - ... print trans.style_guide_url |
2289 | + ... print(trans.language.code) |
2290 | + ... print(trans.translationgroup.name) |
2291 | + ... print(trans.style_guide_url) |
2292 | cy |
2293 | foo-translators |
2294 | None |
2295 | @@ -183,7 +183,7 @@ |
2296 | assigned to that language. |
2297 | |
2298 | >>> for (translator, language, team) in group.fetchTranslatorData(): |
2299 | - ... print translator.language.code, language.code, team.name |
2300 | + ... print(translator.language.code, language.code, team.name) |
2301 | nl nl nl-team |
2302 | de de de-team |
2303 | la la la-team |
2304 | @@ -191,7 +191,7 @@ |
2305 | The members are sorted by language name in English. |
2306 | |
2307 | >>> for (translator, language, person) in group.fetchTranslatorData(): |
2308 | - ... print language.englishname |
2309 | + ... print(language.englishname) |
2310 | Dutch |
2311 | German |
2312 | Latin |
2313 | |
2314 | === modified file 'lib/lp/translations/doc/translationimportqueue.txt' |
2315 | --- lib/lp/translations/doc/translationimportqueue.txt 2015-10-05 08:36:52 +0000 |
2316 | +++ lib/lp/translations/doc/translationimportqueue.txt 2018-06-02 14:12:45 +0000 |
2317 | @@ -35,7 +35,7 @@ |
2318 | >>> def print_list(strings): |
2319 | ... """Print list of strings as list of lines.""" |
2320 | ... for string in strings: |
2321 | - ... print string |
2322 | + ... print(string) |
2323 | |
2324 | |
2325 | getGuessedPOFile |
2326 | @@ -81,7 +81,7 @@ |
2327 | potemplate. |
2328 | |
2329 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2330 | - ... u'po/sr.po', 'foo', True, rosetta_experts, |
2331 | + ... u'po/sr.po', b'foo', True, rosetta_experts, |
2332 | ... productseries=evolution_productseries) |
2333 | |
2334 | This entry has no information about the IPOFile where it should be attached |
2335 | @@ -103,7 +103,7 @@ |
2336 | >>> hoary_distroseries = DistroSeries.get(3) |
2337 | >>> evolution_sourcepackagename = SourcePackageName.get(9) |
2338 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2339 | - ... u'po/sr.po', 'foo', True, rosetta_experts, |
2340 | + ... u'po/sr.po', b'foo', True, rosetta_experts, |
2341 | ... distroseries=hoary_distroseries, |
2342 | ... sourcepackagename=evolution_sourcepackagename) |
2343 | >>> transaction.commit() |
2344 | @@ -139,7 +139,7 @@ |
2345 | Now, we do a new upload. |
2346 | |
2347 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2348 | - ... u'po/sr.po', 'foo', True, rosetta_experts, |
2349 | + ... u'po/sr.po', b'foo', True, rosetta_experts, |
2350 | ... distroseries=hoary_distroseries, |
2351 | ... sourcepackagename=evolution_sourcepackagename) |
2352 | >>> transaction.commit() |
2353 | @@ -178,13 +178,13 @@ |
2354 | |
2355 | >>> by_maintainer = True |
2356 | >>> po_sr_entry = translationimportqueue.addOrUpdateEntry( |
2357 | - ... u'po/sr.po', 'foo', by_maintainer, rosetta_experts, |
2358 | + ... u'po/sr.po', b'foo', by_maintainer, rosetta_experts, |
2359 | ... distroseries=hoary_distroseries, |
2360 | ... sourcepackagename=evolution_sourcepackagename) |
2361 | |
2362 | And the new status is |
2363 | |
2364 | - >>> print po_sr_entry.status.title |
2365 | + >>> print(po_sr_entry.status.title) |
2366 | Needs Review |
2367 | |
2368 | The dateimported remains the same as it was already waiting to be imported. |
2369 | @@ -200,7 +200,7 @@ |
2370 | First, we import a new .pot file. |
2371 | |
2372 | >>> pot_entry = translationimportqueue.addOrUpdateEntry( |
2373 | - ... 'po/evolution-2.2.pot', 'foo', True, rosetta_experts, |
2374 | + ... 'po/evolution-2.2.pot', b'foo', True, rosetta_experts, |
2375 | ... distroseries=hoary_distroseries, |
2376 | ... sourcepackagename=evolution_sourcepackagename) |
2377 | |
2378 | @@ -287,7 +287,7 @@ |
2379 | Let's attach the .pot file |
2380 | |
2381 | >>> kde_pot_entry = translationimportqueue.addOrUpdateEntry( |
2382 | - ... 'po/kdebugdialog.pot', 'foo content', True, rosetta_experts, |
2383 | + ... 'po/kdebugdialog.pot', b'foo content', True, rosetta_experts, |
2384 | ... distroseries=hoary_distroseries, |
2385 | ... sourcepackagename=kdebase) |
2386 | |
2387 | @@ -311,7 +311,7 @@ |
2388 | Let's attach a .po file from kde-i18n-es |
2389 | |
2390 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2391 | - ... 'messages/kdebase/kdebugdialog.po', 'foo content', True, |
2392 | + ... 'messages/kdebase/kdebugdialog.po', b'foo content', True, |
2393 | ... rosetta_experts, distroseries=hoary_distroseries, |
2394 | ... sourcepackagename=kde_i18n_es) |
2395 | |
2396 | @@ -325,7 +325,7 @@ |
2397 | |
2398 | >>> sr_latin = factory.makeLanguage('sr@latin', 'Serbian Latin') |
2399 | >>> sr_latin_entry = translationimportqueue.addOrUpdateEntry( |
2400 | - ... 'messages/kdebase/kdebugdialog.po', 'foo content', True, |
2401 | + ... 'messages/kdebase/kdebugdialog.po', b'foo content', True, |
2402 | ... rosetta_experts, distroseries=hoary_distroseries, |
2403 | ... sourcepackagename=kde_l10n_sr_latin) |
2404 | |
2405 | @@ -338,7 +338,7 @@ |
2406 | that is not yet imported. |
2407 | |
2408 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2409 | - ... 'messages/kdebase/konqueror.po', 'foo content', True, |
2410 | + ... 'messages/kdebase/konqueror.po', b'foo content', True, |
2411 | ... rosetta_experts, distroseries=hoary_distroseries, |
2412 | ... sourcepackagename=kde_i18n_es) |
2413 | |
2414 | @@ -354,7 +354,7 @@ |
2415 | We will see it working here with this example: |
2416 | |
2417 | >>> kde_pot_entry = translationimportqueue.addOrUpdateEntry( |
2418 | - ... 'po/kio_sftp.pot', 'foo content', True, rosetta_experts, |
2419 | + ... 'po/kio_sftp.pot', b'foo content', True, rosetta_experts, |
2420 | ... distroseries=hoary_distroseries, |
2421 | ... sourcepackagename=kdebase) |
2422 | |
2423 | @@ -376,7 +376,7 @@ |
2424 | Let's attach a .po file from kde-i18n-es |
2425 | |
2426 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2427 | - ... 'messages/kdebase/kio_sftp.po', 'foo content', True, |
2428 | + ... 'messages/kdebase/kio_sftp.po', b'foo content', True, |
2429 | ... rosetta_experts, distroseries=hoary_distroseries, |
2430 | ... sourcepackagename=kde_i18n_es) |
2431 | |
2432 | @@ -415,7 +415,7 @@ |
2433 | Let's attach the .pot file |
2434 | |
2435 | >>> koffice_pot_entry = translationimportqueue.addOrUpdateEntry( |
2436 | - ... 'po/koffice.pot', 'foo content', True, rosetta_experts, |
2437 | + ... 'po/koffice.pot', b'foo content', True, rosetta_experts, |
2438 | ... distroseries=hoary_distroseries, |
2439 | ... sourcepackagename=koffice) |
2440 | |
2441 | @@ -440,7 +440,7 @@ |
2442 | |
2443 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2444 | ... 'koffice-i18n-es-1.5.2/messages/koffice/koffice.po', |
2445 | - ... 'foo content', True, rosetta_experts, |
2446 | + ... b'foo content', True, rosetta_experts, |
2447 | ... distroseries=hoary_distroseries, sourcepackagename=koffice_l10n) |
2448 | |
2449 | And we will get the right IPOFile. |
2450 | @@ -453,7 +453,7 @@ |
2451 | >>> sr_latin = factory.makeLanguage('sr@latin', 'Serbian Latin') |
2452 | >>> sr_latin_entry = translationimportqueue.addOrUpdateEntry( |
2453 | ... 'koffice-i18n-sr@latin-1.5.2/messages/koffice/koffice.po', |
2454 | - ... 'foo content', True, rosetta_experts, |
2455 | + ... b'foo content', True, rosetta_experts, |
2456 | ... distroseries=hoary_distroseries, sourcepackagename=koffice_l10n) |
2457 | |
2458 | And we will get the right IPOFile. |
2459 | @@ -466,7 +466,7 @@ |
2460 | |
2461 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2462 | ... 'koffice-i18n-es-1.5.2/messages/koffice/kchart.po', |
2463 | - ... 'foo content', True, rosetta_experts, |
2464 | + ... b'foo content', True, rosetta_experts, |
2465 | ... distroseries=hoary_distroseries, sourcepackagename=koffice_l10n) |
2466 | |
2467 | We don't know the IPOFile where it should be imported. |
2468 | @@ -516,7 +516,7 @@ |
2469 | Let's attach the .pot file |
2470 | |
2471 | >>> adept_pot_entry = translationimportqueue.addOrUpdateEntry( |
2472 | - ... 'po/adept.pot', 'foo content', True, rosetta_experts, |
2473 | + ... 'po/adept.pot', b'foo content', True, rosetta_experts, |
2474 | ... distroseries=hoary_distroseries, |
2475 | ... sourcepackagename=adept) |
2476 | |
2477 | @@ -539,7 +539,7 @@ |
2478 | Let's attach a .po file now. |
2479 | |
2480 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2481 | - ... 'po/es/adept.po', 'foo content', True, |
2482 | + ... 'po/es/adept.po', b'foo content', True, |
2483 | ... rosetta_experts, distroseries=hoary_distroseries, |
2484 | ... sourcepackagename=adept) |
2485 | |
2486 | @@ -552,7 +552,7 @@ |
2487 | that is not yet imported. |
2488 | |
2489 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2490 | - ... 'po/es/adept-foo.po', 'foo content', True, |
2491 | + ... 'po/es/adept-foo.po', b'foo content', True, |
2492 | ... rosetta_experts, distroseries=hoary_distroseries, |
2493 | ... sourcepackagename=adept) |
2494 | |
2495 | @@ -569,7 +569,7 @@ |
2496 | Let's attach the .pot file |
2497 | |
2498 | >>> ktorrent_pot_entry = translationimportqueue.addOrUpdateEntry( |
2499 | - ... 'po/ktorrent.pot', 'foo content', True, rosetta_experts, |
2500 | + ... 'po/ktorrent.pot', b'foo content', True, rosetta_experts, |
2501 | ... distroseries=hoary_distroseries, |
2502 | ... sourcepackagename=ktorrent) |
2503 | |
2504 | @@ -592,7 +592,7 @@ |
2505 | Let's attach a .po file now. |
2506 | |
2507 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2508 | - ... 'translations/es/messages/ktorrent.po', 'foo content', True, |
2509 | + ... 'translations/es/messages/ktorrent.po', b'foo content', True, |
2510 | ... rosetta_experts, distroseries=hoary_distroseries, |
2511 | ... sourcepackagename=ktorrent) |
2512 | |
2513 | @@ -605,7 +605,7 @@ |
2514 | that is not yet imported. |
2515 | |
2516 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2517 | - ... 'translations/es/messages/ktorrent-foo.po', 'foo content', True, |
2518 | + ... 'translations/es/messages/ktorrent-foo.po', b'foo content', True, |
2519 | ... rosetta_experts, distroseries=hoary_distroseries, |
2520 | ... sourcepackagename=ktorrent) |
2521 | |
2522 | @@ -624,7 +624,7 @@ |
2523 | >>> zope_pot_entry = translationimportqueue.addOrUpdateEntry( |
2524 | ... 'debian/zope3/usr/lib/python2.4/site-packages/zope/app/' |
2525 | ... 'locales/zope.pot', |
2526 | - ... 'foo content', True, rosetta_experts, |
2527 | + ... b'foo content', True, rosetta_experts, |
2528 | ... distroseries=hoary_distroseries, sourcepackagename=zope) |
2529 | |
2530 | Create the template name and attach this new import to it. |
2531 | @@ -650,7 +650,7 @@ |
2532 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2533 | ... 'debian/zope3/usr/lib/python2.4/site-packages/zope/app/locales' |
2534 | ... '/es/LC_MESSAGES/zope.po', |
2535 | - ... 'foo content', True, rosetta_experts, |
2536 | + ... b'foo content', True, rosetta_experts, |
2537 | ... distroseries=hoary_distroseries, sourcepackagename=zope) |
2538 | |
2539 | And we will get the right IPOFile. |
2540 | @@ -664,7 +664,7 @@ |
2541 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2542 | ... 'debian/zope3/usr/lib/python2.4/site-packages/zope/app/' |
2543 | ... 'locales/es/LC_MESSAGES/zope-test.po', |
2544 | - ... 'foo content', True, rosetta_experts, |
2545 | + ... b'foo content', True, rosetta_experts, |
2546 | ... distroseries=hoary_distroseries, sourcepackagename=zope) |
2547 | |
2548 | We don't know the IPOFile where it should be imported. |
2549 | @@ -682,7 +682,7 @@ |
2550 | Let's attach the .pot file |
2551 | |
2552 | >>> k3b_pot_entry = translationimportqueue.addOrUpdateEntry( |
2553 | - ... 'po/k3b.pot', 'foo content', True, rosetta_experts, |
2554 | + ... 'po/k3b.pot', b'foo content', True, rosetta_experts, |
2555 | ... distroseries=hoary_distroseries, sourcepackagename=k3b) |
2556 | |
2557 | Create the template name and attach this new import to it. |
2558 | @@ -702,7 +702,7 @@ |
2559 | Let's attach a .po file now. |
2560 | |
2561 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2562 | - ... 'es/messages/k3b.po', 'foo content', True, rosetta_experts, |
2563 | + ... 'es/messages/k3b.po', b'foo content', True, rosetta_experts, |
2564 | ... distroseries=hoary_distroseries, sourcepackagename=k3b_i18n) |
2565 | |
2566 | And we will get the right IPOFile. |
2567 | @@ -714,7 +714,7 @@ |
2568 | that is not yet imported. |
2569 | |
2570 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2571 | - ... 'es/messages/libk3b.po', 'foo content', True, rosetta_experts, |
2572 | + ... 'es/messages/libk3b.po', b'foo content', True, rosetta_experts, |
2573 | ... distroseries=hoary_distroseries, sourcepackagename=k3b_i18n) |
2574 | |
2575 | We don't know the IPOFile where it should be imported. |
2576 | @@ -730,7 +730,7 @@ |
2577 | Let's attach the .pot file |
2578 | |
2579 | >>> terminal_pot_entry = translationimportqueue.addOrUpdateEntry( |
2580 | - ... 'drivemount/help/drivemount.pot', 'foo content', True, |
2581 | + ... 'drivemount/help/drivemount.pot', b'foo content', True, |
2582 | ... rosetta_experts, distroseries=hoary_distroseries, |
2583 | ... sourcepackagename=gnome_terminal) |
2584 | |
2585 | @@ -752,7 +752,7 @@ |
2586 | Let's attach a .po file now. |
2587 | |
2588 | >>> es_entry = translationimportqueue.addOrUpdateEntry( |
2589 | - ... 'drivemount/help/es/es.po', 'foo content', True, rosetta_experts, |
2590 | + ... 'drivemount/help/es/es.po', b'foo content', True, rosetta_experts, |
2591 | ... distroseries=hoary_distroseries, |
2592 | ... sourcepackagename=gnome_terminal) |
2593 | |
2594 | @@ -765,7 +765,7 @@ |
2595 | that is not yet imported. |
2596 | |
2597 | >>> es_without_potemplate_entry = translationimportqueue.addOrUpdateEntry( |
2598 | - ... 'wanda/help/es/es.po', 'foo content', True, rosetta_experts, |
2599 | + ... 'wanda/help/es/es.po', b'foo content', True, rosetta_experts, |
2600 | ... distroseries=hoary_distroseries, sourcepackagename=gnome_terminal) |
2601 | |
2602 | We don't know the IPOFile where it should be imported. |
2603 | @@ -873,7 +873,7 @@ |
2604 | |
2605 | >>> productseries = ProductSeries.get(1) |
2606 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2607 | - ... 'foo/bar.po', 'foo content', True, |
2608 | + ... 'foo/bar.po', b'foo content', True, |
2609 | ... rosetta_experts, productseries=productseries) |
2610 | |
2611 | When we just import it, this method tells us that it's "just requested" |
2612 | @@ -989,7 +989,7 @@ |
2613 | ... template = 'None' |
2614 | ... if entry.potemplate is not None: |
2615 | ... template = entry.potemplate.name |
2616 | - ... print '%s | %s | %s' % (context, template, entry.path) |
2617 | + ... print('%s | %s | %s' % (context, template, entry.path)) |
2618 | |
2619 | Current entries in the queue are: |
2620 | |
2621 | @@ -1058,47 +1058,47 @@ |
2622 | |
2623 | >>> existing_entry = getFirstEvoEntryByPath(queue, 'foo.pot') |
2624 | >>> existing_entry = removeSecurityProxy(existing_entry) |
2625 | - >>> print existing_entry.content.read() |
2626 | + >>> print(existing_entry.content.read()) |
2627 | Foo template |
2628 | |
2629 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2630 | - ... "foo.pot", "New content", by_maintainer, rosetta_experts, |
2631 | + ... "foo.pot", b"New content", by_maintainer, rosetta_experts, |
2632 | ... productseries=evolution_productseries, |
2633 | ... potemplate=evolution_22_test_template) |
2634 | >>> entry = removeSecurityProxy(entry) |
2635 | >>> transaction.commit() |
2636 | >>> entry is existing_entry |
2637 | True |
2638 | - >>> print entry.content.read() |
2639 | + >>> print(entry.content.read()) |
2640 | New content |
2641 | |
2642 | Not specifying the potemplate in this situation still selects the same entry |
2643 | on a best match basis. The entry is updated. |
2644 | |
2645 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2646 | - ... "foo.pot", "Even newer content", by_maintainer, rosetta_experts, |
2647 | + ... "foo.pot", b"Even newer content", by_maintainer, rosetta_experts, |
2648 | ... productseries=evolution_productseries) |
2649 | >>> entry = removeSecurityProxy(entry) |
2650 | >>> transaction.commit() |
2651 | >>> entry is existing_entry |
2652 | True |
2653 | - >>> print entry.content.read() |
2654 | + >>> print(entry.content.read()) |
2655 | Even newer content |
2656 | |
2657 | Same goes for pofile entries. |
2658 | |
2659 | >>> existing_entry = getFirstEvoEntryByPath(queue, 'es.po') |
2660 | >>> existing_entry = removeSecurityProxy(existing_entry) |
2661 | - >>> print existing_entry.content.read() |
2662 | + >>> print(existing_entry.content.read()) |
2663 | Spanish translation |
2664 | |
2665 | >>> entry = removeSecurityProxy(translationimportqueue.addOrUpdateEntry( |
2666 | - ... "es.po", "New po content", by_maintainer, rosetta_experts, |
2667 | + ... "es.po", b"New po content", by_maintainer, rosetta_experts, |
2668 | ... productseries=evolution_productseries)) |
2669 | >>> transaction.commit() |
2670 | >>> entry is existing_entry |
2671 | True |
2672 | - >>> print entry.content.read() |
2673 | + >>> print(entry.content.read()) |
2674 | New po content |
2675 | |
2676 | Now, attaching the same layout to a different template for the same product, |
2677 | @@ -1128,20 +1128,20 @@ |
2678 | Not specifying the potemplate now is ambiguous and so no entry is added or |
2679 | updated. |
2680 | |
2681 | - >>> print queue.addOrUpdateEntry( |
2682 | - ... "foo.pot", "Latest content", by_maintainer, rosetta_experts, |
2683 | - ... productseries=evolution_productseries) |
2684 | + >>> print(queue.addOrUpdateEntry( |
2685 | + ... "foo.pot", b"Latest content", by_maintainer, rosetta_experts, |
2686 | + ... productseries=evolution_productseries)) |
2687 | None |
2688 | |
2689 | Ambiguity is also resolved when a file is uploaded to the product first and |
2690 | then to a specific template. |
2691 | |
2692 | >>> existing_entry = queue.addOrUpdateEntry( |
2693 | - ... "bar.pot", "Bar content", by_maintainer, rosetta_experts, |
2694 | + ... "bar.pot", b"Bar content", by_maintainer, rosetta_experts, |
2695 | ... productseries=evolution_productseries) |
2696 | >>> existing_entry = removeSecurityProxy(existing_entry) |
2697 | >>> entry = queue.addOrUpdateEntry( |
2698 | - ... "bar.pot", "Bar content", by_maintainer, rosetta_experts, |
2699 | + ... "bar.pot", b"Bar content", by_maintainer, rosetta_experts, |
2700 | ... productseries=evolution_productseries, |
2701 | ... potemplate=evolution_22_template) |
2702 | |
2703 | @@ -1158,13 +1158,13 @@ |
2704 | When uploading to the prouct now, the best matching entry is updated. |
2705 | |
2706 | >>> entry = queue.addOrUpdateEntry( |
2707 | - ... "bar.pot", "New bar content", by_maintainer, rosetta_experts, |
2708 | + ... "bar.pot", b"New bar content", by_maintainer, rosetta_experts, |
2709 | ... productseries=evolution_productseries) |
2710 | >>> entry = removeSecurityProxy(entry) |
2711 | >>> transaction.commit() |
2712 | >>> entry is existing_entry |
2713 | True |
2714 | - >>> print entry.content.read() |
2715 | + >>> print(entry.content.read()) |
2716 | New bar content |
2717 | |
2718 | Filename filters |
2719 | @@ -1226,14 +1226,14 @@ |
2720 | >>> def print_import_failures(import_script): |
2721 | ... """List failures recorded in an import script instance.""" |
2722 | ... for reason, entries in script.failures.iteritems(): |
2723 | - ... print reason |
2724 | + ... print(reason) |
2725 | ... for entry in entries: |
2726 | - ... print "-> " + entry |
2727 | + ... print("-> " + entry) |
2728 | |
2729 | >>> clear_queue(translationimportqueue) |
2730 | |
2731 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2732 | - ... u'po/sr.po', 'foo', True, rosetta_experts, |
2733 | + ... u'po/sr.po', b'foo', True, rosetta_experts, |
2734 | ... productseries=evolution_productseries) |
2735 | |
2736 | >>> entry.import_into is None |
2737 | @@ -1260,7 +1260,7 @@ |
2738 | |
2739 | The entry is marked as Failed. |
2740 | |
2741 | - >>> print entry.status.name |
2742 | + >>> print(entry.status.name) |
2743 | FAILED |
2744 | |
2745 | This happens for distribution packages as well as products. |
2746 | @@ -1268,7 +1268,7 @@ |
2747 | >>> clear_queue(translationimportqueue) |
2748 | |
2749 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2750 | - ... u'po/th.po', 'bar', False, rosetta_experts, |
2751 | + ... u'po/th.po', b'bar', False, rosetta_experts, |
2752 | ... distroseries=hoary_distroseries, |
2753 | ... sourcepackagename=evolution_sourcepackagename) |
2754 | |
2755 | @@ -1285,7 +1285,7 @@ |
2756 | Entry is approved but has no place to import to. |
2757 | -> 'po/th.po' (id ...) in ubuntu Hoary package evolution |
2758 | |
2759 | - >>> print entry.status.name |
2760 | + >>> print(entry.status.name) |
2761 | FAILED |
2762 | |
2763 | >>> clear_queue(translationimportqueue) |
2764 | @@ -1319,7 +1319,7 @@ |
2765 | days. |
2766 | |
2767 | >>> entry = translationimportqueue.addOrUpdateEntry( |
2768 | - ... u'po/nl.po', 'hoi', True, rosetta_experts, |
2769 | + ... u'po/nl.po', b'hoi', True, rosetta_experts, |
2770 | ... productseries=evolution_productseries) |
2771 | >>> entry.pofile = factory.makePOFile('nl') |
2772 | >>> entry.setStatus(RosettaImportStatus.IMPORTED, rosetta_experts) |
2773 | @@ -1357,7 +1357,7 @@ |
2774 | ... # In another completely arbitrary move, we make all import |
2775 | ... # requests for products non-imported. |
2776 | ... return translationimportqueue.addOrUpdateEntry('messages.pot', |
2777 | - ... 'dummy file', False, rosetta_experts, productseries=series, |
2778 | + ... b'dummy file', False, rosetta_experts, productseries=series, |
2779 | ... potemplate=template) |
2780 | |
2781 | >>> jokosher = productset['jokosher'] |
2782 | |
2783 | === modified file 'lib/lp/translations/doc/translationmessage-destroy.txt' |
2784 | --- lib/lp/translations/doc/translationmessage-destroy.txt 2012-05-08 04:41:05 +0000 |
2785 | +++ lib/lp/translations/doc/translationmessage-destroy.txt 2018-06-02 14:12:45 +0000 |
2786 | @@ -62,7 +62,7 @@ |
2787 | ... pofile=devel_sr_pofile, |
2788 | ... potmsgset=potmsgset, |
2789 | ... translations=[u"blah"]) |
2790 | - >>> print POFileTranslator.select( |
2791 | + >>> print(POFileTranslator.select( |
2792 | ... "pofile IN (%s, %s)" |
2793 | - ... % sqlvalues(devel_sr_pofile, stable_sr_pofile)).count() |
2794 | + ... % sqlvalues(devel_sr_pofile, stable_sr_pofile)).count()) |
2795 | 2 |
2796 | |
2797 | === modified file 'lib/lp/translations/doc/translationmessage.txt' |
2798 | --- lib/lp/translations/doc/translationmessage.txt 2012-12-26 01:32:19 +0000 |
2799 | +++ lib/lp/translations/doc/translationmessage.txt 2018-06-02 14:12:45 +0000 |
2800 | @@ -41,7 +41,7 @@ |
2801 | |
2802 | We can look at a POTMsgSet with no plural forms: |
2803 | |
2804 | - >>> print potmsgset.plural_text |
2805 | + >>> print(potmsgset.plural_text) |
2806 | None |
2807 | |
2808 | Any TranslationMessage for such a POTMsgSet returns a single plural form in |
2809 | @@ -57,7 +57,7 @@ |
2810 | 1 |
2811 | |
2812 | >>> divehi = getUtility(ILanguageSet)['dv'] |
2813 | - >>> print divehi.pluralforms |
2814 | + >>> print(divehi.pluralforms) |
2815 | None |
2816 | >>> current_dv = potmsgset.getCurrentTranslationMessageOrDummy( |
2817 | ... DummyPOFile(potemplate, divehi)) |
2818 | @@ -82,7 +82,7 @@ |
2819 | In case the language doesn't have number of plural forms defined, we return |
2820 | a default of 2, which is the most common number of plural forms: |
2821 | |
2822 | - >>> print divehi.pluralforms |
2823 | + >>> print(divehi.pluralforms) |
2824 | None |
2825 | >>> current_dv = potmsgset_plural.getCurrentTranslationMessageOrDummy( |
2826 | ... DummyPOFile(potemplate, divehi)) |
2827 | @@ -247,9 +247,9 @@ |
2828 | |
2829 | >>> for translation in message.all_msgstrs: |
2830 | ... if translation is None: |
2831 | - ... print 'None' |
2832 | + ... print('None') |
2833 | ... else: |
2834 | - ... print translation.translation |
2835 | + ... print(translation.translation) |
2836 | new |
2837 | None |
2838 | None |
2839 | @@ -271,7 +271,7 @@ |
2840 | The helper function make_plurals_fragment repeats a fragment of text |
2841 | for the number of plural forms we support (starting at zero). |
2842 | |
2843 | - >>> print make_plurals_fragment("x%(form)dx", ", ") |
2844 | + >>> print(make_plurals_fragment("x%(form)dx", ", ")) |
2845 | x0x, |
2846 | x1x, |
2847 | x2x, |
2848 | @@ -283,7 +283,7 @@ |
2849 | The make_plurals_sql_fragment helper adds some parentheses and spaces |
2850 | where you might otherwise forget them--or want to. |
2851 | |
2852 | - >>> print make_plurals_sql_fragment("msgstr%(form)d IS NOT NULL") |
2853 | + >>> print(make_plurals_sql_fragment("msgstr%(form)d IS NOT NULL")) |
2854 | (msgstr0 IS NOT NULL) AND |
2855 | (msgstr1 IS NOT NULL) AND |
2856 | (msgstr2 IS NOT NULL) AND |
2857 | @@ -293,7 +293,7 @@ |
2858 | |
2859 | The sub-clauses don't have to be tied together with AND: |
2860 | |
2861 | - >>> print make_plurals_sql_fragment("msgstr%(form)d IS NULL", "OR") |
2862 | + >>> print(make_plurals_sql_fragment("msgstr%(form)d IS NULL", "OR")) |
2863 | (msgstr0 IS NULL) OR |
2864 | (msgstr1 IS NULL) OR |
2865 | (msgstr2 IS NULL) OR |
2866 | |
2867 | === modified file 'lib/lp/translations/doc/translationrelicensingagreement.txt' |
2868 | --- lib/lp/translations/doc/translationrelicensingagreement.txt 2012-12-26 01:32:19 +0000 |
2869 | +++ lib/lp/translations/doc/translationrelicensingagreement.txt 2018-06-02 14:12:45 +0000 |
2870 | @@ -21,20 +21,20 @@ |
2871 | |
2872 | When Karl has not made his selection yet, it is marked as None. |
2873 | |
2874 | - >>> print translations_person.translations_relicensing_agreement |
2875 | + >>> print(translations_person.translations_relicensing_agreement) |
2876 | None |
2877 | >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person) |
2878 | - >>> print choice |
2879 | + >>> print(choice) |
2880 | None |
2881 | |
2882 | Setting a value will create a new TranslationRelicensingAgreement |
2883 | object. |
2884 | |
2885 | >>> translations_person.translations_relicensing_agreement = True |
2886 | - >>> print translations_person.translations_relicensing_agreement |
2887 | + >>> print(translations_person.translations_relicensing_agreement) |
2888 | True |
2889 | >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person) |
2890 | - >>> print choice.allow_relicensing |
2891 | + >>> print(choice.allow_relicensing) |
2892 | True |
2893 | |
2894 | A `choice` implements ITranslationRelicensingAgreement interface: |
2895 | @@ -45,8 +45,8 @@ |
2896 | A translator can also change their mind later. |
2897 | |
2898 | >>> translations_person.translations_relicensing_agreement = False |
2899 | - >>> print translations_person.translations_relicensing_agreement |
2900 | + >>> print(translations_person.translations_relicensing_agreement) |
2901 | False |
2902 | >>> choice = TranslationRelicensingAgreement.selectOneBy(person=person) |
2903 | - >>> print choice.allow_relicensing |
2904 | + >>> print(choice.allow_relicensing) |
2905 | False |
2906 | |
2907 | === modified file 'lib/lp/translations/doc/translations-export-to-branch.txt' |
2908 | --- lib/lp/translations/doc/translations-export-to-branch.txt 2011-12-21 19:25:05 +0000 |
2909 | +++ lib/lp/translations/doc/translations-export-to-branch.txt 2018-06-02 14:12:45 +0000 |
2910 | @@ -12,7 +12,7 @@ |
2911 | 0 |
2912 | >>> stdout |
2913 | '' |
2914 | - >>> print stderr |
2915 | + >>> print(stderr) |
2916 | INFO Creating lockfile: |
2917 | /var/lock/launchpad-translations-export-to-branch.lock |
2918 | INFO Exporting to translations branches. |
2919 | @@ -256,10 +256,10 @@ |
2920 | |
2921 | >>> sender, recipients, body = stub.test_emails.pop() |
2922 | >>> message = message_from_string(body) |
2923 | - >>> print message['Subject'] |
2924 | + >>> print(message['Subject']) |
2925 | Launchpad: translations branch has not been set up. |
2926 | |
2927 | - >>> print message.get_payload() |
2928 | + >>> print(message.get_payload()) |
2929 | Hello, |
2930 | There was a problem with translations branch synchronization for |
2931 | ... |
2932 | |
2933 | === modified file 'lib/lp/translations/doc/translationsoverview.txt' |
2934 | --- lib/lp/translations/doc/translationsoverview.txt 2012-11-23 22:10:04 +0000 |
2935 | +++ lib/lp/translations/doc/translationsoverview.txt 2018-06-02 14:12:45 +0000 |
2936 | @@ -57,7 +57,7 @@ |
2937 | >>> naked_overview = removeSecurityProxy(overview) |
2938 | >>> result = naked_overview._normalizeSizes(test_list, 0, 3) |
2939 | >>> for pillar in result: |
2940 | - ... print "%s: %d" % (pillar['pillar'], pillar['weight']) |
2941 | + ... print("%s: %d" % (pillar['pillar'], pillar['weight'])) |
2942 | one: 18 |
2943 | two: 10 |
2944 | three: 13 |
2945 | @@ -91,8 +91,8 @@ |
2946 | |
2947 | >>> def display_pillars(pillars): |
2948 | ... for pillar in pillars: |
2949 | - ... print "%s: %d" % ( |
2950 | - ... pillar['pillar'].displayname, pillar['weight']) |
2951 | + ... print("%s: %d" % ( |
2952 | + ... pillar['pillar'].displayname, pillar['weight'])) |
2953 | >>> display_pillars(overview.getMostTranslatedPillars()) |
2954 | Evolution: 14 |
2955 | |
2956 | |
2957 | === modified file 'lib/lp/translations/doc/translationsperson.txt' |
2958 | --- lib/lp/translations/doc/translationsperson.txt 2010-10-05 00:08:16 +0000 |
2959 | +++ lib/lp/translations/doc/translationsperson.txt 2018-06-02 14:12:45 +0000 |
2960 | @@ -17,7 +17,7 @@ |
2961 | >>> daf = personset.getByName('daf') |
2962 | >>> translations_daf = ITranslationsPerson(daf) |
2963 | >>> for language in translations_daf.translatable_languages: |
2964 | - ... print language.code, language.englishname |
2965 | + ... print(language.code, language.englishname) |
2966 | en_GB English (United Kingdom) |
2967 | ja Japanese |
2968 | cy Welsh |
2969 | @@ -25,7 +25,7 @@ |
2970 | >>> carlos = personset.getByName('carlos') |
2971 | >>> translations_carlos = ITranslationsPerson(carlos) |
2972 | >>> for language in translations_carlos.translatable_languages: |
2973 | - ... print language.code, language.englishname |
2974 | + ... print(language.code, language.englishname) |
2975 | ca Catalan |
2976 | es Spanish |
2977 | |
2978 | @@ -33,12 +33,10 @@ |
2979 | for a Person: |
2980 | |
2981 | >>> for pt in translations_carlos.translation_history: |
2982 | - ... print pt.pofile.title |
2983 | + ... print(pt.pofile.title) |
2984 | English (en) trans... of pkgconf-mozilla in Ubuntu Hoary package "mozilla" |
2985 | Spanish (es) translation of alsa-utils in alsa-utils trunk |
2986 | Spanish (es) translation of man in Ubuntu Hoary package "evolution" |
2987 | Spanish (es) translation of evolution-2.2 in Evolution trunk |
2988 | Japanese (ja) tran... of evolution-2.2 in Ubuntu Hoary package "evolution" |
2989 | Spanish (es) trans... of evolution-2.2 in Ubuntu Hoary package "evolution" |
2990 | - |
2991 | - |
2992 | |
2993 | === modified file 'lib/lp/translations/doc/vpoexport.txt' |
2994 | --- lib/lp/translations/doc/vpoexport.txt 2013-03-28 05:05:15 +0000 |
2995 | +++ lib/lp/translations/doc/vpoexport.txt 2018-06-02 14:12:45 +0000 |
2996 | @@ -23,7 +23,7 @@ |
2997 | ... describe_pofile(pofile) |
2998 | ... for pofile in vpoexportset.get_distroseries_pofiles(hoary)]) |
2999 | >>> for pofile in pofiles: |
3000 | - ... print pofile |
3001 | + ... print(pofile) |
3002 | evolution evolution-2.2 es |
3003 | evolution evolution-2.2 ja |
3004 | evolution evolution-2.2 xh |
3005 | @@ -52,9 +52,9 @@ |
3006 | pmount pmount it_IT |
3007 | pmount pmount nb |
3008 | |
3009 | - >>> print len(pofiles) |
3010 | + >>> print(len(pofiles)) |
3011 | 27 |
3012 | - >>> print vpoexportset.get_distroseries_pofiles_count(hoary) |
3013 | + >>> print(vpoexportset.get_distroseries_pofiles_count(hoary)) |
3014 | 27 |
3015 | |
3016 | The getTranslationRows method lists all translations found in the |
3017 | @@ -82,7 +82,7 @@ |
3018 | ... describe_poexport_row(row) |
3019 | ... for row in pofile.getTranslationRows()]) |
3020 | >>> for row in rows: |
3021 | - ... print row |
3022 | + ... print(row) |
3023 | 1 english1 esperanto1 |
3024 | 2 english2 esperanto2 |
3025 | |
3026 | @@ -94,7 +94,7 @@ |
3027 | ... describe_poexport_row(row) |
3028 | ... for row in pofile.getChangedRows()]) |
3029 | >>> for row in rows: |
3030 | - ... print row |
3031 | + ... print(row) |
3032 | 2 english2 esperanto2 |
3033 | |
3034 | |
3035 | @@ -137,13 +137,13 @@ |
3036 | When we export trunk, only the trunk message shows up. |
3037 | |
3038 | >>> for row in trunk_pofile.getTranslationRows(): |
3039 | - ... print describe_poexport_row(row) |
3040 | + ... print(describe_poexport_row(row)) |
3041 | 1 1 een |
3042 | 2 2 None |
3043 | |
3044 | In an export for stable, only the stable message shows up. |
3045 | |
3046 | >>> for row in stable_pofile.getTranslationRows(): |
3047 | - ... print describe_poexport_row(row) |
3048 | + ... print(describe_poexport_row(row)) |
3049 | 2 2 twee |
3050 | 1 1 None |
3051 | |
3052 | === modified file 'lib/lp/translations/doc/vpotexport.txt' |
3053 | --- lib/lp/translations/doc/vpotexport.txt 2011-10-06 08:57:09 +0000 |
3054 | +++ lib/lp/translations/doc/vpotexport.txt 2018-06-02 14:12:45 +0000 |
3055 | @@ -69,7 +69,7 @@ |
3056 | The POT file header is a template of common information that will get filled |
3057 | in with language specifics by translators. |
3058 | |
3059 | - >>> print first.template_header |
3060 | + >>> print(first.template_header) |
3061 | Project-Id-Version: PACKAGE VERSION |
3062 | Report-Msgid-Bugs-To: |
3063 | POT-Creation-Date: 2005-08-25 14:56+0200 |
3064 | |
3065 | === modified file 'lib/lp/translations/tests/test_doc.py' |
3066 | --- lib/lp/translations/tests/test_doc.py 2018-05-06 08:52:34 +0000 |
3067 | +++ lib/lp/translations/tests/test_doc.py 2018-06-02 14:12:45 +0000 |
3068 | @@ -18,6 +18,7 @@ |
3069 | from lp.testing.pages import PageTestSuite |
3070 | from lp.testing.systemdocs import ( |
3071 | LayeredDocFileSuite, |
3072 | + setGlobs, |
3073 | setUp, |
3074 | tearDown, |
3075 | ) |
3076 | @@ -29,23 +30,28 @@ |
3077 | special = { |
3078 | 'poexport-queue.txt': LayeredDocFileSuite( |
3079 | '../doc/poexport-queue.txt', |
3080 | - setUp=setUp, tearDown=tearDown, layer=LaunchpadFunctionalLayer |
3081 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown, |
3082 | + layer=LaunchpadFunctionalLayer, |
3083 | ), |
3084 | 'translationimportqueue.txt': LayeredDocFileSuite( |
3085 | '../doc/translationimportqueue.txt', |
3086 | - setUp=setUp, tearDown=tearDown, layer=LaunchpadFunctionalLayer |
3087 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown, |
3088 | + layer=LaunchpadFunctionalLayer, |
3089 | ), |
3090 | 'rosetta-karma.txt': LayeredDocFileSuite( |
3091 | '../doc/rosetta-karma.txt', |
3092 | - setUp=setUp, tearDown=tearDown, layer=LaunchpadFunctionalLayer |
3093 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown, |
3094 | + layer=LaunchpadFunctionalLayer, |
3095 | ), |
3096 | 'translationmessage-destroy.txt': LayeredDocFileSuite( |
3097 | '../doc/translationmessage-destroy.txt', |
3098 | - layer=LaunchpadZopelessLayer |
3099 | + setUp=lambda test: setGlobs(test, future=True), |
3100 | + layer=LaunchpadZopelessLayer, |
3101 | ), |
3102 | 'translationsoverview.txt': LayeredDocFileSuite( |
3103 | '../doc/translationsoverview.txt', |
3104 | - layer=LaunchpadZopelessLayer |
3105 | + setUp=lambda test: setGlobs(test, future=True), |
3106 | + layer=LaunchpadZopelessLayer, |
3107 | ), |
3108 | } |
3109 | |
3110 | @@ -79,7 +85,8 @@ |
3111 | for filename in filenames: |
3112 | path = os.path.join('../doc/', filename) |
3113 | one_test = LayeredDocFileSuite( |
3114 | - path, setUp=setUp, tearDown=tearDown, |
3115 | + path, |
3116 | + setUp=lambda test: setUp(test, future=True), tearDown=tearDown, |
3117 | layer=LaunchpadFunctionalLayer, |
3118 | stdout_logging_level=logging.WARNING) |
3119 | suite.addTest(one_test) |
Self-approving: large, test-only, and mostly mechanical (I just had to pay some attention to bytes/text, particularly around calls to TranslationImpo rtQueue. addOrUpdateEntr y).