Merge lp:~henninge/launchpad/recife-rename-from-upstream into lp:~launchpad/launchpad/recife
- recife-rename-from-upstream
- Merge into recife
Proposed by
Henning Eggers
Status: | Merged |
---|---|
Merged at revision: | 9184 |
Proposed branch: | lp:~henninge/launchpad/recife-rename-from-upstream |
Merge into: | lp:~launchpad/launchpad/recife |
Diff against target: |
1242 lines (+169/-166) 30 files modified
database/sampledata/current-dev.sql (+2/-2) database/sampledata/current.sql (+2/-2) database/schema/comments.sql (+1/-1) database/schema/patch-2208-99-1.sql (+1/-1) lib/lp/soyuz/interfaces/sourcepackagerelease.py (+3/-3) lib/lp/soyuz/model/sourcepackagerelease.py (+2/-2) lib/lp/testing/factory.py (+2/-2) lib/lp/translations/browser/pofile.py (+3/-3) lib/lp/translations/browser/translationimportqueue.py (+4/-4) lib/lp/translations/doc/poexport-language-pack.txt (+3/-3) lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt (+5/-5) lib/lp/translations/doc/poimport-pofile-old-po-imported.txt (+7/-7) lib/lp/translations/doc/poimport-pofile-syntax-error.txt (+4/-4) lib/lp/translations/doc/poimport-potemplate-syntax-error.txt (+4/-4) lib/lp/translations/doc/poimport.txt (+4/-4) lib/lp/translations/doc/rosetta-karma.txt (+12/-12) lib/lp/translations/doc/translationimportqueue.txt (+16/-16) lib/lp/translations/interfaces/translationimportqueue.py (+11/-9) lib/lp/translations/model/pofile.py (+5/-5) lib/lp/translations/model/translationimportqueue.py (+12/-12) lib/lp/translations/utilities/gettext_po_importer.py (+2/-2) lib/lp/translations/utilities/mozilla_xpi_importer.py (+2/-2) lib/lp/translations/utilities/tests/helpers.py (+7/-5) lib/lp/translations/utilities/tests/import-flags.txt (+6/-6) lib/lp/translations/utilities/tests/test_file_importer.py (+19/-19) lib/lp/translations/utilities/tests/test_gettext_po_importer.py (+3/-3) lib/lp/translations/utilities/tests/test_kde_po_importer.py (+4/-4) lib/lp/translations/utilities/tests/test_xpi_import.py (+1/-1) lib/lp/translations/utilities/tests/test_xpi_po_exporter.py (+2/-2) lib/lp/translations/utilities/translation_import.py (+20/-21) |
To merge this branch: | bzr merge lp:~henninge/launchpad/recife-rename-from-upstream |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | code | Approve | |
Review via email: mp+39980@code.launchpad.net |
Commit message
Renamed TranslationImpo
Description of the change
Rename TranslationImpo
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
(code)
Revision history for this message
Hein Mück (heinmueck) wrote : | # |
1 | === modified file 'database/sampledata/current-dev.sql' | |||
2 | --- database/sampledata/current-dev.sql 2010-10-18 16:36:46 +0000 | |||
3 | +++ database/sampledata/current-dev.sql 2010-11-03 21:48:03 +0000 | |||
4 | @@ -11001,8 +11001,8 @@ | |||
5 | 11001 | 11001 | ||
6 | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; |
7 | 11003 | 11003 | ||
10 | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); |
11 | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); |
12 | 11006 | 11006 | ||
13 | 11007 | 11007 | ||
14 | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; |
15 | 11009 | 11009 | ||
16 | === modified file 'database/sampledata/current.sql' | |||
17 | --- database/sampledata/current.sql 2010-10-18 16:36:46 +0000 | |||
18 | +++ database/sampledata/current.sql 2010-11-03 21:48:03 +0000 | |||
19 | @@ -11001,8 +11001,8 @@ | |||
20 | 11001 | 11001 | ||
21 | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; |
22 | 11003 | 11003 | ||
25 | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); |
26 | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); |
27 | 11006 | 11006 | ||
28 | 11007 | 11007 | ||
29 | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; |
30 | 11009 | 11009 | ||
31 | === modified file 'database/schema/patch-2208-99-1.sql' | |||
32 | --- database/schema/patch-2208-99-1.sql 2010-08-24 07:54:39 +0000 | |||
33 | +++ database/schema/patch-2208-99-1.sql 2010-11-03 21:48:03 +0000 | |||
34 | @@ -4,6 +4,6 @@ | |||
35 | 4 | SET client_min_messages=ERROR; | 4 | SET client_min_messages=ERROR; |
36 | 5 | 5 | ||
37 | 6 | ALTER TABLE TranslationImportQueueEntry | 6 | ALTER TABLE TranslationImportQueueEntry |
39 | 7 | RENAME COLUMN is_published TO from_upstream; | 7 | RENAME COLUMN is_published TO by_maintainer; |
40 | 8 | 8 | ||
41 | 9 | INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1); | 9 | INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1); |
Revision history for this message
Henning Eggers (henninge) wrote : | # |
This branch still has problems. I will have to look into that on Monday.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'database/sampledata/current-dev.sql' | |||
2 | --- database/sampledata/current-dev.sql 2010-11-04 09:32:28 +0000 | |||
3 | +++ database/sampledata/current-dev.sql 2010-11-09 12:03:48 +0000 | |||
4 | @@ -11001,8 +11001,8 @@ | |||
5 | 11001 | 11001 | ||
6 | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; |
7 | 11003 | 11003 | ||
10 | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); |
11 | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); |
12 | 11006 | 11006 | ||
13 | 11007 | 11007 | ||
14 | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; |
15 | 11009 | 11009 | ||
16 | === modified file 'database/sampledata/current.sql' | |||
17 | --- database/sampledata/current.sql 2010-11-04 09:32:28 +0000 | |||
18 | +++ database/sampledata/current.sql 2010-11-09 12:03:48 +0000 | |||
19 | @@ -11001,8 +11001,8 @@ | |||
20 | 11001 | 11001 | ||
21 | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; | 11002 | ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL; |
22 | 11003 | 11003 | ||
25 | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); | 11004 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (1, 'po/evolution-2.2-test.pot', 57, 16, '2006-12-13 21:17:56.241901', NULL, NULL, 3, true, NULL, 6, 2, '2006-12-13 21:18:40.885499', 1, NULL); |
26 | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, from_upstream, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); | 11005 | INSERT INTO translationimportqueueentry (id, path, content, importer, dateimported, distroseries, sourcepackagename, productseries, by_maintainer, pofile, potemplate, status, date_status_changed, format, error_output) VALUES (2, 'po/pt_BR.po', 58, 16, '2006-12-13 21:18:28.796588', NULL, NULL, 3, true, 30, 6, 2, '2006-12-13 21:18:40.898084', 1, NULL); |
27 | 11006 | 11006 | ||
28 | 11007 | 11007 | ||
29 | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; | 11008 | ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL; |
30 | 11009 | 11009 | ||
31 | === modified file 'database/schema/comments.sql' | |||
32 | --- database/schema/comments.sql 2010-11-04 09:32:28 +0000 | |||
33 | +++ database/schema/comments.sql 2010-11-09 12:03:48 +0000 | |||
34 | @@ -2036,7 +2036,7 @@ | |||
35 | 2036 | COMMENT ON COLUMN TranslationImportQueueEntry.distroseries IS 'The distribution release related to this import.'; | 2036 | COMMENT ON COLUMN TranslationImportQueueEntry.distroseries IS 'The distribution release related to this import.'; |
36 | 2037 | COMMENT ON COLUMN TranslationImportQueueEntry.sourcepackagename IS 'The source package name related to this import.'; | 2037 | COMMENT ON COLUMN TranslationImportQueueEntry.sourcepackagename IS 'The source package name related to this import.'; |
37 | 2038 | COMMENT ON COLUMN TranslationImportQueueEntry.productseries IS 'The product series related to this import.'; | 2038 | COMMENT ON COLUMN TranslationImportQueueEntry.productseries IS 'The product series related to this import.'; |
39 | 2039 | COMMENT ON COLUMN TranslationImportQueueEntry.from_upstream IS 'Notes whether this upload is from an upstream project.'; | 2039 | COMMENT ON COLUMN TranslationImportQueueEntry.by_maintainer IS 'Notes whether this upload was done by the maintiner of the package or project.'; |
40 | 2040 | COMMENT ON COLUMN TranslationImportQueueEntry.pofile IS 'Link to the POFile where this import will end.'; | 2040 | COMMENT ON COLUMN TranslationImportQueueEntry.pofile IS 'Link to the POFile where this import will end.'; |
41 | 2041 | COMMENT ON COLUMN TranslationImportQueueEntry.potemplate IS 'Link to the POTemplate where this import will end.'; | 2041 | COMMENT ON COLUMN TranslationImportQueueEntry.potemplate IS 'Link to the POTemplate where this import will end.'; |
42 | 2042 | COMMENT ON COLUMN TranslationImportQueueEntry.date_status_changed IS 'The date when the status of this entry was changed.'; | 2042 | COMMENT ON COLUMN TranslationImportQueueEntry.date_status_changed IS 'The date when the status of this entry was changed.'; |
43 | 2043 | 2043 | ||
44 | === modified file 'database/schema/patch-2208-99-1.sql' | |||
45 | --- database/schema/patch-2208-99-1.sql 2010-08-24 07:54:39 +0000 | |||
46 | +++ database/schema/patch-2208-99-1.sql 2010-11-09 12:03:48 +0000 | |||
47 | @@ -4,6 +4,6 @@ | |||
48 | 4 | SET client_min_messages=ERROR; | 4 | SET client_min_messages=ERROR; |
49 | 5 | 5 | ||
50 | 6 | ALTER TABLE TranslationImportQueueEntry | 6 | ALTER TABLE TranslationImportQueueEntry |
52 | 7 | RENAME COLUMN is_published TO from_upstream; | 7 | RENAME COLUMN is_published TO by_maintainer; |
53 | 8 | 8 | ||
54 | 9 | INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1); | 9 | INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1); |
55 | 10 | 10 | ||
56 | === modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py' | |||
57 | --- lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-09-06 10:40:54 +0000 | |||
58 | +++ lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-11-09 12:03:48 +0000 | |||
59 | @@ -194,13 +194,13 @@ | |||
60 | 194 | argument remains untouched. | 194 | argument remains untouched. |
61 | 195 | """ | 195 | """ |
62 | 196 | 196 | ||
64 | 197 | def attachTranslationFiles(tarball_alias, from_upstream, importer=None): | 197 | def attachTranslationFiles(tarball_alias, by_maintainer, importer=None): |
65 | 198 | """Attach a tarball with translations to be imported into Rosetta. | 198 | """Attach a tarball with translations to be imported into Rosetta. |
66 | 199 | 199 | ||
67 | 200 | :tarball_alias: is a Librarian alias that references to a tarball with | 200 | :tarball_alias: is a Librarian alias that references to a tarball with |
68 | 201 | translations. | 201 | translations. |
71 | 202 | :from_upstream: indicates if the imported files are from an upstream | 202 | :by_maintainer: indicates if the imported files where uploaded by |
72 | 203 | project. | 203 | the maintainer of the project or package. |
73 | 204 | :importer: is the person that did the import. | 204 | :importer: is the person that did the import. |
74 | 205 | 205 | ||
75 | 206 | raise DownloadFailed if we are not able to fetch the file from | 206 | raise DownloadFailed if we are not able to fetch the file from |
76 | 207 | 207 | ||
77 | === modified file 'lib/lp/soyuz/model/sourcepackagerelease.py' | |||
78 | --- lib/lp/soyuz/model/sourcepackagerelease.py 2010-09-06 10:40:54 +0000 | |||
79 | +++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-11-09 12:03:48 +0000 | |||
80 | @@ -592,7 +592,7 @@ | |||
81 | 592 | 592 | ||
82 | 593 | return change | 593 | return change |
83 | 594 | 594 | ||
85 | 595 | def attachTranslationFiles(self, tarball_alias, from_upstream, | 595 | def attachTranslationFiles(self, tarball_alias, by_maintainer, |
86 | 596 | importer=None): | 596 | importer=None): |
87 | 597 | """See ISourcePackageRelease.""" | 597 | """See ISourcePackageRelease.""" |
88 | 598 | tarball = tarball_alias.read() | 598 | tarball = tarball_alias.read() |
89 | @@ -603,7 +603,7 @@ | |||
90 | 603 | queue = getUtility(ITranslationImportQueue) | 603 | queue = getUtility(ITranslationImportQueue) |
91 | 604 | 604 | ||
92 | 605 | queue.addOrUpdateEntriesFromTarball( | 605 | queue.addOrUpdateEntriesFromTarball( |
94 | 606 | tarball, from_upstream, importer, | 606 | tarball, by_maintainer, importer, |
95 | 607 | sourcepackagename=self.sourcepackagename, | 607 | sourcepackagename=self.sourcepackagename, |
96 | 608 | distroseries=self.upload_distroseries, | 608 | distroseries=self.upload_distroseries, |
97 | 609 | filename_filter=_filter_ubuntu_translation_file) | 609 | filename_filter=_filter_ubuntu_translation_file) |
98 | 610 | 610 | ||
99 | === modified file 'lib/lp/testing/factory.py' | |||
100 | --- lib/lp/testing/factory.py 2010-11-09 06:55:07 +0000 | |||
101 | +++ lib/lp/testing/factory.py 2010-11-09 12:03:48 +0000 | |||
102 | @@ -2610,7 +2610,7 @@ | |||
103 | 2610 | potemplate=None, content=None, | 2610 | potemplate=None, content=None, |
104 | 2611 | uploader=None, pofile=None, | 2611 | uploader=None, pofile=None, |
105 | 2612 | format=None, status=None, | 2612 | format=None, status=None, |
107 | 2613 | from_upstream=False): | 2613 | by_maintainer=False): |
108 | 2614 | """Create a `TranslationImportQueueEntry`.""" | 2614 | """Create a `TranslationImportQueueEntry`.""" |
109 | 2615 | if path is None: | 2615 | if path is None: |
110 | 2616 | path = self.getUniqueString() + '.pot' | 2616 | path = self.getUniqueString() + '.pot' |
111 | @@ -2652,7 +2652,7 @@ | |||
112 | 2652 | path=path, productseries=productseries, distroseries=distroseries, | 2652 | path=path, productseries=productseries, distroseries=distroseries, |
113 | 2653 | sourcepackagename=sourcepackagename, importer=uploader, | 2653 | sourcepackagename=sourcepackagename, importer=uploader, |
114 | 2654 | content=content_reference, status=status, format=format, | 2654 | content=content_reference, status=status, format=format, |
116 | 2655 | from_upstream=from_upstream) | 2655 | by_maintainer=by_maintainer) |
117 | 2656 | 2656 | ||
118 | 2657 | def makeMailingList(self, team, owner): | 2657 | def makeMailingList(self, team, owner): |
119 | 2658 | """Create a mailing list for the team.""" | 2658 | """Create a mailing list for the team.""" |
120 | 2659 | 2659 | ||
121 | === modified file 'lib/lp/translations/browser/pofile.py' | |||
122 | --- lib/lp/translations/browser/pofile.py 2010-11-08 02:29:37 +0000 | |||
123 | +++ lib/lp/translations/browser/pofile.py 2010-11-09 12:03:48 +0000 | |||
124 | @@ -700,8 +700,8 @@ | |||
125 | 700 | " recognised as a file that can be imported.") | 700 | " recognised as a file that can be imported.") |
126 | 701 | return | 701 | return |
127 | 702 | 702 | ||
130 | 703 | # Uploads on this form are never from upstream. | 703 | # Uploads on this form are never done by the maintainer. |
131 | 704 | from_upstream = False | 704 | by_maintainer = False |
132 | 705 | 705 | ||
133 | 706 | if self.context.path is None: | 706 | if self.context.path is None: |
134 | 707 | # The POFile is a dummy one, we use the filename as the path. | 707 | # The POFile is a dummy one, we use the filename as the path. |
135 | @@ -710,7 +710,7 @@ | |||
136 | 710 | path = self.context.path | 710 | path = self.context.path |
137 | 711 | # Add it to the queue. | 711 | # Add it to the queue. |
138 | 712 | translation_import_queue.addOrUpdateEntry( | 712 | translation_import_queue.addOrUpdateEntry( |
140 | 713 | path, content, from_upstream, self.user, | 713 | path, content, by_maintainer, self.user, |
141 | 714 | sourcepackagename=self.context.potemplate.sourcepackagename, | 714 | sourcepackagename=self.context.potemplate.sourcepackagename, |
142 | 715 | distroseries=self.context.potemplate.distroseries, | 715 | distroseries=self.context.potemplate.distroseries, |
143 | 716 | productseries=self.context.potemplate.productseries, | 716 | productseries=self.context.potemplate.productseries, |
144 | 717 | 717 | ||
145 | === modified file 'lib/lp/translations/browser/translationimportqueue.py' | |||
146 | --- lib/lp/translations/browser/translationimportqueue.py 2010-11-05 08:11:53 +0000 | |||
147 | +++ lib/lp/translations/browser/translationimportqueue.py 2010-11-09 12:03:48 +0000 | |||
148 | @@ -507,10 +507,10 @@ | |||
149 | 507 | self.context.path = path | 507 | self.context.path = path |
150 | 508 | # We got a path to store as the new one for the POFile. | 508 | # We got a path to store as the new one for the POFile. |
151 | 509 | pofile.setPathIfUnique(path) | 509 | pofile.setPathIfUnique(path) |
156 | 510 | elif self.context.from_upstream: | 510 | elif self.context.by_maintainer: |
157 | 511 | # This entry comes from upstream, which means that the path we | 511 | # This entry was uploaded by the maintainer, which means that the |
158 | 512 | # got is exactly the right one. If it's different from what | 512 | # path we got is exactly the right one. If it's different from |
159 | 513 | # pofile has, that would mean that either the entry changed | 513 | # what pofile has, that would mean that either the entry changed |
160 | 514 | # its path since previous upload or that we had to guess it | 514 | # its path since previous upload or that we had to guess it |
161 | 515 | # and now that we got the right path, we should fix it. | 515 | # and now that we got the right path, we should fix it. |
162 | 516 | pofile.setPathIfUnique(self.context.path) | 516 | pofile.setPathIfUnique(self.context.path) |
163 | 517 | 517 | ||
164 | === modified file 'lib/lp/translations/doc/poexport-language-pack.txt' | |||
165 | --- lib/lp/translations/doc/poexport-language-pack.txt 2010-11-05 08:11:53 +0000 | |||
166 | +++ lib/lp/translations/doc/poexport-language-pack.txt 2010-11-09 12:03:48 +0000 | |||
167 | @@ -184,9 +184,9 @@ | |||
168 | 184 | 184 | ||
169 | 185 | >>> en_US_xpi = get_en_US_xpi_file_to_import('en-US') | 185 | >>> en_US_xpi = get_en_US_xpi_file_to_import('en-US') |
170 | 186 | >>> translation_import_queue = getUtility(ITranslationImportQueue) | 186 | >>> translation_import_queue = getUtility(ITranslationImportQueue) |
172 | 187 | >>> from_upstream = True | 187 | >>> by_maintainer = True |
173 | 188 | >>> template_entry = translation_import_queue.addOrUpdateEntry( | 188 | >>> template_entry = translation_import_queue.addOrUpdateEntry( |
175 | 189 | ... firefox_template.path, en_US_xpi.read(), from_upstream, | 189 | ... firefox_template.path, en_US_xpi.read(), by_maintainer, |
176 | 190 | ... mark, distroseries=series, sourcepackagename=spn, | 190 | ... mark, distroseries=series, sourcepackagename=spn, |
177 | 191 | ... potemplate=firefox_template) | 191 | ... potemplate=firefox_template) |
178 | 192 | 192 | ||
179 | @@ -195,7 +195,7 @@ | |||
180 | 195 | >>> es_xpi = get_en_US_xpi_file_to_import('en-US') | 195 | >>> es_xpi = get_en_US_xpi_file_to_import('en-US') |
181 | 196 | >>> firefox_es_translation = firefox_template.newPOFile('es') | 196 | >>> firefox_es_translation = firefox_template.newPOFile('es') |
182 | 197 | >>> translation_entry = translation_import_queue.addOrUpdateEntry( | 197 | >>> translation_entry = translation_import_queue.addOrUpdateEntry( |
184 | 198 | ... 'es.xpi', es_xpi.read(), from_upstream, | 198 | ... 'es.xpi', es_xpi.read(), by_maintainer, |
185 | 199 | ... mark, distroseries=series, sourcepackagename=spn, | 199 | ... mark, distroseries=series, sourcepackagename=spn, |
186 | 200 | ... potemplate=firefox_template, | 200 | ... potemplate=firefox_template, |
187 | 201 | ... pofile=firefox_es_translation) | 201 | ... pofile=firefox_es_translation) |
188 | 202 | 202 | ||
189 | === modified file 'lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt' | |||
190 | --- lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2010-11-05 08:11:53 +0000 | |||
191 | +++ lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2010-11-09 12:03:48 +0000 | |||
192 | @@ -63,7 +63,7 @@ | |||
193 | 63 | 63 | ||
194 | 64 | >>> pofile = potemplate.newPOFile('cy') | 64 | >>> pofile = potemplate.newPOFile('cy') |
195 | 65 | 65 | ||
197 | 66 | And now, we import a .po file, as not coming from upstream, that lacks the | 66 | And now, we import a .po file, not uploaded by the maintainer, that lacks the |
198 | 67 | header 'X-Rosetta-Export-Date'. That header is the one that notes that the | 67 | header 'X-Rosetta-Export-Date'. That header is the one that notes that the |
199 | 68 | file comes from a previous export from Rosetta and when did it happen. | 68 | file comes from a previous export from Rosetta and when did it happen. |
200 | 69 | 69 | ||
201 | @@ -77,9 +77,9 @@ | |||
202 | 77 | ... msgid "foo" | 77 | ... msgid "foo" |
203 | 78 | ... msgstr "blah" | 78 | ... msgstr "blah" |
204 | 79 | ... ''' | 79 | ... ''' |
206 | 80 | >>> from_upstream = False | 80 | >>> by_maintainer = False |
207 | 81 | >>> entry = translation_import_queue.addOrUpdateEntry( | 81 | >>> entry = translation_import_queue.addOrUpdateEntry( |
209 | 82 | ... pofile.path, pofile_contents, from_upstream, person, | 82 | ... pofile.path, pofile_contents, by_maintainer, person, |
210 | 83 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 83 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
211 | 84 | >>> transaction.commit() | 84 | >>> transaction.commit() |
212 | 85 | 85 | ||
213 | @@ -147,9 +147,9 @@ | |||
214 | 147 | 147 | ||
215 | 148 | Now, attach the file again, but this time as coming from upstream. | 148 | Now, attach the file again, but this time as coming from upstream. |
216 | 149 | 149 | ||
218 | 150 | >>> from_upstream = True | 150 | >>> by_maintainer = True |
219 | 151 | >>> entry = translation_import_queue.addOrUpdateEntry( | 151 | >>> entry = translation_import_queue.addOrUpdateEntry( |
221 | 152 | ... pofile.path, pofile_contents, from_upstream, person, | 152 | ... pofile.path, pofile_contents, by_maintainer, person, |
222 | 153 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 153 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
223 | 154 | >>> transaction.commit() | 154 | >>> transaction.commit() |
224 | 155 | 155 | ||
225 | 156 | 156 | ||
226 | === modified file 'lib/lp/translations/doc/poimport-pofile-old-po-imported.txt' | |||
227 | --- lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2010-11-05 08:11:53 +0000 | |||
228 | +++ lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2010-11-09 12:03:48 +0000 | |||
229 | @@ -76,9 +76,9 @@ | |||
230 | 76 | ... msgid "foo" | 76 | ... msgid "foo" |
231 | 77 | ... msgstr "blah" | 77 | ... msgstr "blah" |
232 | 78 | ... ''' % datetime.datetime.now(UTC).isoformat() | 78 | ... ''' % datetime.datetime.now(UTC).isoformat() |
234 | 79 | >>> from_upstream = False | 79 | >>> by_maintainer = False |
235 | 80 | >>> entry = translation_import_queue.addOrUpdateEntry( | 80 | >>> entry = translation_import_queue.addOrUpdateEntry( |
237 | 81 | ... pofile.path, pofile_contents, from_upstream, person, | 81 | ... pofile.path, pofile_contents, by_maintainer, person, |
238 | 82 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 82 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
239 | 83 | >>> transaction.commit() | 83 | >>> transaction.commit() |
240 | 84 | 84 | ||
241 | @@ -124,9 +124,9 @@ | |||
242 | 124 | ... msgid "foo" | 124 | ... msgid "foo" |
243 | 125 | ... msgstr "blah" | 125 | ... msgstr "blah" |
244 | 126 | ... ''' % datetime.datetime.now(UTC).isoformat() | 126 | ... ''' % datetime.datetime.now(UTC).isoformat() |
246 | 127 | >>> from_upstream = False | 127 | >>> by_maintainer = False |
247 | 128 | >>> entry = translation_import_queue.addOrUpdateEntry( | 128 | >>> entry = translation_import_queue.addOrUpdateEntry( |
249 | 129 | ... pofile.path, pofile_contents, from_upstream, person, | 129 | ... pofile.path, pofile_contents, by_maintainer, person, |
250 | 130 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 130 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
251 | 131 | >>> transaction.commit() | 131 | >>> transaction.commit() |
252 | 132 | 132 | ||
253 | @@ -185,11 +185,11 @@ | |||
254 | 185 | <BLANKLINE> | 185 | <BLANKLINE> |
255 | 186 | 186 | ||
256 | 187 | Finally we are going to import the same po file with the old | 187 | Finally we are going to import the same po file with the old |
258 | 188 | 'PO-Revision-Date' field but mark it as a file coming from upstream. | 188 | 'PO-Revision-Date' field but mark it as a file uploaded by the maintainer. |
259 | 189 | 189 | ||
261 | 190 | >>> from_upstream = True | 190 | >>> by_maintainer = True |
262 | 191 | >>> entry = translation_import_queue.addOrUpdateEntry( | 191 | >>> entry = translation_import_queue.addOrUpdateEntry( |
264 | 192 | ... pofile.path, pofile_contents, from_upstream, person, | 192 | ... pofile.path, pofile_contents, by_maintainer, person, |
265 | 193 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 193 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
266 | 194 | >>> transaction.commit() | 194 | >>> transaction.commit() |
267 | 195 | 195 | ||
268 | 196 | 196 | ||
269 | === modified file 'lib/lp/translations/doc/poimport-pofile-syntax-error.txt' | |||
270 | --- lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2010-11-05 08:11:53 +0000 | |||
271 | +++ lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2010-11-09 12:03:48 +0000 | |||
272 | @@ -72,9 +72,9 @@ | |||
273 | 72 | ... msgid "foo" | 72 | ... msgid "foo" |
274 | 73 | ... msgstr blah" | 73 | ... msgstr blah" |
275 | 74 | ... ''' % datetime.datetime.now(UTC).isoformat() | 74 | ... ''' % datetime.datetime.now(UTC).isoformat() |
277 | 75 | >>> from_upstream = False | 75 | >>> by_maintainer = False |
278 | 76 | >>> entry = translation_import_queue.addOrUpdateEntry( | 76 | >>> entry = translation_import_queue.addOrUpdateEntry( |
280 | 77 | ... pofile.path, pofile_contents, from_upstream, person, | 77 | ... pofile.path, pofile_contents, by_maintainer, person, |
281 | 78 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 78 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
282 | 79 | >>> transaction.commit() | 79 | >>> transaction.commit() |
283 | 80 | 80 | ||
284 | @@ -137,9 +137,9 @@ | |||
285 | 137 | ... msgid "\xa9 Yoyodine Industries" | 137 | ... msgid "\xa9 Yoyodine Industries" |
286 | 138 | ... msgstr "" | 138 | ... msgstr "" |
287 | 139 | ... '''.encode('utf-8') | 139 | ... '''.encode('utf-8') |
289 | 140 | >>> from_upstream = False | 140 | >>> by_maintainer = False |
290 | 141 | >>> entry = translation_import_queue.addOrUpdateEntry( | 141 | >>> entry = translation_import_queue.addOrUpdateEntry( |
292 | 142 | ... pofile.path, pofile_contents, from_upstream, person, | 142 | ... pofile.path, pofile_contents, by_maintainer, person, |
293 | 143 | ... productseries=series, potemplate=potemplate, pofile=pofile) | 143 | ... productseries=series, potemplate=potemplate, pofile=pofile) |
294 | 144 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 144 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
295 | 145 | >>> transaction.commit() | 145 | >>> transaction.commit() |
296 | 146 | 146 | ||
297 | === modified file 'lib/lp/translations/doc/poimport-potemplate-syntax-error.txt' | |||
298 | --- lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2010-11-05 08:11:53 +0000 | |||
299 | +++ lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2010-11-09 12:03:48 +0000 | |||
300 | @@ -57,9 +57,9 @@ | |||
301 | 57 | ... msgid "foo" | 57 | ... msgid "foo" |
302 | 58 | ... msgstr "" | 58 | ... msgstr "" |
303 | 59 | ... ''' | 59 | ... ''' |
305 | 60 | >>> from_upstream = True | 60 | >>> by_maintainer = True |
306 | 61 | >>> entry = translation_import_queue.addOrUpdateEntry( | 61 | >>> entry = translation_import_queue.addOrUpdateEntry( |
308 | 62 | ... potemplate.path, potemplate_contents, from_upstream, person, | 62 | ... potemplate.path, potemplate_contents, by_maintainer, person, |
309 | 63 | ... productseries=series, potemplate=potemplate) | 63 | ... productseries=series, potemplate=potemplate) |
310 | 64 | >>> transaction.commit() | 64 | >>> transaction.commit() |
311 | 65 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 65 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
312 | @@ -119,9 +119,9 @@ | |||
313 | 119 | ... msgid "\xa9 Yoyodine Industries" | 119 | ... msgid "\xa9 Yoyodine Industries" |
314 | 120 | ... msgstr "" | 120 | ... msgstr "" |
315 | 121 | ... '''.encode('utf-8') | 121 | ... '''.encode('utf-8') |
317 | 122 | >>> from_upstream = False | 122 | >>> by_maintainer = False |
318 | 123 | >>> entry = translation_import_queue.addOrUpdateEntry( | 123 | >>> entry = translation_import_queue.addOrUpdateEntry( |
320 | 124 | ... potemplate.path, potemplate_contents, from_upstream, person, | 124 | ... potemplate.path, potemplate_contents, by_maintainer, person, |
321 | 125 | ... productseries=series, potemplate=potemplate) | 125 | ... productseries=series, potemplate=potemplate) |
322 | 126 | >>> transaction.commit() | 126 | >>> transaction.commit() |
323 | 127 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 127 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
324 | 128 | 128 | ||
325 | === modified file 'lib/lp/translations/doc/poimport.txt' | |||
326 | --- lib/lp/translations/doc/poimport.txt 2010-11-05 08:11:53 +0000 | |||
327 | +++ lib/lp/translations/doc/poimport.txt 2010-11-09 12:03:48 +0000 | |||
328 | @@ -703,7 +703,7 @@ | |||
329 | 703 | Upstream import notifications | 703 | Upstream import notifications |
330 | 704 | ----------------------------- | 704 | ----------------------------- |
331 | 705 | 705 | ||
333 | 706 | Add an upstream POFile import (i.e. from a package or bzr branch), | 706 | Add a maintainer POFile import (i.e. from a package or bzr branch), |
334 | 707 | approve and import it. | 707 | approve and import it. |
335 | 708 | 708 | ||
336 | 709 | >>> pofile_contents = r''' | 709 | >>> pofile_contents = r''' |
337 | @@ -719,9 +719,9 @@ | |||
338 | 719 | ... msgstr "blah" | 719 | ... msgstr "blah" |
339 | 720 | ... ''' | 720 | ... ''' |
340 | 721 | >>> pofile = factory.makePOFile('sr', potemplate=potemplate) | 721 | >>> pofile = factory.makePOFile('sr', potemplate=potemplate) |
342 | 722 | >>> from_upstream = True | 722 | >>> by_maintainer = True |
343 | 723 | >>> entry = translation_import_queue.addOrUpdateEntry( | 723 | >>> entry = translation_import_queue.addOrUpdateEntry( |
345 | 724 | ... pofile.path, pofile_contents, from_upstream, person, | 724 | ... pofile.path, pofile_contents, by_maintainer, person, |
346 | 725 | ... distroseries=distroseries, sourcepackagename=sourcepackagename, | 725 | ... distroseries=distroseries, sourcepackagename=sourcepackagename, |
347 | 726 | ... potemplate=potemplate, pofile=pofile) | 726 | ... potemplate=potemplate, pofile=pofile) |
348 | 727 | >>> transaction.commit() | 727 | >>> transaction.commit() |
349 | @@ -742,7 +742,7 @@ | |||
350 | 742 | 742 | ||
351 | 743 | >>> pofile_contents = pofile_contents[:-2] | 743 | >>> pofile_contents = pofile_contents[:-2] |
352 | 744 | >>> entry = translation_import_queue.addOrUpdateEntry( | 744 | >>> entry = translation_import_queue.addOrUpdateEntry( |
354 | 745 | ... pofile.path, pofile_contents, from_upstream, person, | 745 | ... pofile.path, pofile_contents, by_maintainer, person, |
355 | 746 | ... distroseries=distroseries, sourcepackagename=sourcepackagename, | 746 | ... distroseries=distroseries, sourcepackagename=sourcepackagename, |
356 | 747 | ... potemplate=potemplate, pofile=pofile) | 747 | ... potemplate=potemplate, pofile=pofile) |
357 | 748 | >>> transaction.commit() | 748 | >>> transaction.commit() |
358 | 749 | 749 | ||
359 | === modified file 'lib/lp/translations/doc/rosetta-karma.txt' | |||
360 | --- lib/lp/translations/doc/rosetta-karma.txt 2010-11-05 08:11:53 +0000 | |||
361 | +++ lib/lp/translations/doc/rosetta-karma.txt 2010-11-09 12:03:48 +0000 | |||
362 | @@ -52,9 +52,9 @@ | |||
363 | 52 | automatic imports from Ubuntu. In this case, we shouldn't give any kind | 52 | automatic imports from Ubuntu. In this case, we shouldn't give any kind |
364 | 53 | of karma to that user. | 53 | of karma to that user. |
365 | 54 | 54 | ||
367 | 55 | >>> comes_from_upstream = True | 55 | >>> uploaded_by_maintainer = True |
368 | 56 | >>> entry = translation_import_queue.addOrUpdateEntry( | 56 | >>> entry = translation_import_queue.addOrUpdateEntry( |
370 | 57 | ... potemplate.path, potemplate_contents, comes_from_upstream, | 57 | ... potemplate.path, potemplate_contents, uploaded_by_maintainer, |
371 | 58 | ... rosetta_experts, productseries=potemplate.productseries, | 58 | ... rosetta_experts, productseries=potemplate.productseries, |
372 | 59 | ... potemplate=potemplate) | 59 | ... potemplate=potemplate) |
373 | 60 | 60 | ||
374 | @@ -89,7 +89,7 @@ | |||
375 | 89 | 89 | ||
376 | 90 | >>> potemplate = POTemplate.get(1) | 90 | >>> potemplate = POTemplate.get(1) |
377 | 91 | >>> entry = translation_import_queue.addOrUpdateEntry( | 91 | >>> entry = translation_import_queue.addOrUpdateEntry( |
379 | 92 | ... potemplate.path, potemplate_contents, comes_from_upstream, | 92 | ... potemplate.path, potemplate_contents, uploaded_by_maintainer, |
380 | 93 | ... foo_bar, productseries=potemplate.productseries, | 93 | ... foo_bar, productseries=potemplate.productseries, |
381 | 94 | ... potemplate=potemplate) | 94 | ... potemplate=potemplate) |
382 | 95 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 95 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
383 | @@ -145,7 +145,7 @@ | |||
384 | 145 | Do the import. | 145 | Do the import. |
385 | 146 | 146 | ||
386 | 147 | >>> entry = translation_import_queue.addOrUpdateEntry( | 147 | >>> entry = translation_import_queue.addOrUpdateEntry( |
388 | 148 | ... pofile.path, pofile_contents, comes_from_upstream, | 148 | ... pofile.path, pofile_contents, uploaded_by_maintainer, |
389 | 149 | ... rosetta_experts, productseries=potemplate.productseries, | 149 | ... rosetta_experts, productseries=potemplate.productseries, |
390 | 150 | ... potemplate=potemplate, pofile=pofile) | 150 | ... potemplate=potemplate, pofile=pofile) |
391 | 151 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 151 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
392 | @@ -172,7 +172,7 @@ | |||
393 | 172 | >>> potemplate = POTemplate.get(1) | 172 | >>> potemplate = POTemplate.get(1) |
394 | 173 | >>> pofile = potemplate.getPOFileByLang('es') | 173 | >>> pofile = potemplate.getPOFileByLang('es') |
395 | 174 | >>> entry = translation_import_queue.addOrUpdateEntry( | 174 | >>> entry = translation_import_queue.addOrUpdateEntry( |
397 | 175 | ... pofile.path, pofile_contents, comes_from_upstream, foo_bar, | 175 | ... pofile.path, pofile_contents, uploaded_by_maintainer, foo_bar, |
398 | 176 | ... productseries=potemplate.productseries, potemplate=potemplate, | 176 | ... productseries=potemplate.productseries, potemplate=potemplate, |
399 | 177 | ... pofile=pofile) | 177 | ... pofile=pofile) |
400 | 178 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 178 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
401 | @@ -209,7 +209,7 @@ | |||
402 | 209 | >>> potemplate = POTemplate.get(1) | 209 | >>> potemplate = POTemplate.get(1) |
403 | 210 | >>> pofile = potemplate.getPOFileByLang('es') | 210 | >>> pofile = potemplate.getPOFileByLang('es') |
404 | 211 | >>> entry = translation_import_queue.addOrUpdateEntry( | 211 | >>> entry = translation_import_queue.addOrUpdateEntry( |
406 | 212 | ... pofile.path, pofile_contents, not comes_from_upstream, foo_bar, | 212 | ... pofile.path, pofile_contents, not uploaded_by_maintainer, foo_bar, |
407 | 213 | ... productseries=potemplate.productseries, potemplate=potemplate, | 213 | ... productseries=potemplate.productseries, potemplate=potemplate, |
408 | 214 | ... pofile=pofile) | 214 | ... pofile=pofile) |
409 | 215 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 215 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
410 | @@ -241,7 +241,7 @@ | |||
411 | 241 | >>> potemplate = POTemplate.get(1) | 241 | >>> potemplate = POTemplate.get(1) |
412 | 242 | >>> pofile = potemplate.getPOFileByLang('es') | 242 | >>> pofile = potemplate.getPOFileByLang('es') |
413 | 243 | >>> entry = translation_import_queue.addOrUpdateEntry( | 243 | >>> entry = translation_import_queue.addOrUpdateEntry( |
415 | 244 | ... pofile.path, pofile_contents, not comes_from_upstream, foo_bar, | 244 | ... pofile.path, pofile_contents, not uploaded_by_maintainer, foo_bar, |
416 | 245 | ... productseries=potemplate.productseries, potemplate=potemplate, | 245 | ... productseries=potemplate.productseries, potemplate=potemplate, |
417 | 246 | ... pofile=pofile) | 246 | ... pofile=pofile) |
418 | 247 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) | 247 | >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts) |
419 | @@ -294,13 +294,13 @@ | |||
420 | 294 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') | 294 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') |
421 | 295 | >>> new_translations = {0: 'bar'} | 295 | >>> new_translations = {0: 'bar'} |
422 | 296 | >>> fuzzy = False | 296 | >>> fuzzy = False |
424 | 297 | >>> from_upstream = False | 297 | >>> by_maintainer = False |
425 | 298 | 298 | ||
426 | 299 | And we can see as he won't get any karma activity from that, otherwise it'd be | 299 | And we can see as he won't get any karma activity from that, otherwise it'd be |
427 | 300 | printed after the call to updateTranslationSet(). | 300 | printed after the call to updateTranslationSet(). |
428 | 301 | 301 | ||
429 | 302 | >>> translationmessage = potmsgset.updateTranslation( | 302 | >>> translationmessage = potmsgset.updateTranslation( |
431 | 303 | ... pofile, no_priv, new_translations, from_upstream, | 303 | ... pofile, no_priv, new_translations, by_maintainer, |
432 | 304 | ... lock_timestamp=datetime.datetime.now(UTC)) | 304 | ... lock_timestamp=datetime.datetime.now(UTC)) |
433 | 305 | >>> flush_database_caches() | 305 | >>> flush_database_caches() |
434 | 306 | 306 | ||
435 | @@ -315,7 +315,7 @@ | |||
436 | 315 | >>> pofile = potemplate.getPOFileByLang('es') | 315 | >>> pofile = potemplate.getPOFileByLang('es') |
437 | 316 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') | 316 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') |
438 | 317 | >>> translationmessage = potmsgset.updateTranslation( | 317 | >>> translationmessage = potmsgset.updateTranslation( |
440 | 318 | ... pofile, no_priv, new_translations, from_upstream, | 318 | ... pofile, no_priv, new_translations, by_maintainer, |
441 | 319 | ... lock_timestamp=datetime.datetime.now(UTC)) | 319 | ... lock_timestamp=datetime.datetime.now(UTC)) |
442 | 320 | Karma added: action=translationsuggestionadded, product=evolution | 320 | Karma added: action=translationsuggestionadded, product=evolution |
443 | 321 | >>> transaction.commit() | 321 | >>> transaction.commit() |
444 | @@ -334,7 +334,7 @@ | |||
445 | 334 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') | 334 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') |
446 | 335 | >>> new_translations = {0: u'somethingelse'} | 335 | >>> new_translations = {0: u'somethingelse'} |
447 | 336 | >>> translationmessage = potmsgset.updateTranslation( | 336 | >>> translationmessage = potmsgset.updateTranslation( |
449 | 337 | ... pofile, kurem, new_translations, from_upstream, | 337 | ... pofile, kurem, new_translations, by_maintainer, |
450 | 338 | ... lock_timestamp=datetime.datetime.now(UTC)) | 338 | ... lock_timestamp=datetime.datetime.now(UTC)) |
451 | 339 | Karma added: action=translationsuggestionapproved, product=evolution | 339 | Karma added: action=translationsuggestionapproved, product=evolution |
452 | 340 | Karma added: action=translationreview, product=evolution | 340 | Karma added: action=translationreview, product=evolution |
453 | @@ -349,7 +349,7 @@ | |||
454 | 349 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') | 349 | >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo') |
455 | 350 | >>> new_translations = {0: u'changed again'} | 350 | >>> new_translations = {0: u'changed again'} |
456 | 351 | >>> translationmessage = potmsgset.updateTranslation( | 351 | >>> translationmessage = potmsgset.updateTranslation( |
458 | 352 | ... pofile, kurem, new_translations, from_upstream, | 352 | ... pofile, kurem, new_translations, by_maintainer, |
459 | 353 | ... lock_timestamp=datetime.datetime.now(UTC)) | 353 | ... lock_timestamp=datetime.datetime.now(UTC)) |
460 | 354 | Karma added: action=translationsuggestionapproved, product=evolution | 354 | Karma added: action=translationsuggestionapproved, product=evolution |
461 | 355 | >>> transaction.commit() | 355 | >>> transaction.commit() |
462 | 356 | 356 | ||
463 | === modified file 'lib/lp/translations/doc/translationimportqueue.txt' | |||
464 | --- lib/lp/translations/doc/translationimportqueue.txt 2010-11-05 08:11:53 +0000 | |||
465 | +++ lib/lp/translations/doc/translationimportqueue.txt 2010-11-09 12:03:48 +0000 | |||
466 | @@ -156,11 +156,11 @@ | |||
467 | 156 | >>> transaction.commit() | 156 | >>> transaction.commit() |
468 | 157 | >>> previous_date_status_changed = entry.date_status_changed | 157 | >>> previous_date_status_changed = entry.date_status_changed |
469 | 158 | 158 | ||
471 | 159 | Do the new upload. It will be an upstream upload. | 159 | Do the new upload. It will be an upload by the maintainer. |
472 | 160 | 160 | ||
474 | 161 | >>> from_upstream = True | 161 | >>> by_maintainer = True |
475 | 162 | >>> po_sr_entry = translationimportqueue.addOrUpdateEntry( | 162 | >>> po_sr_entry = translationimportqueue.addOrUpdateEntry( |
477 | 163 | ... u'po/sr.po', 'foo', from_upstream, rosetta_experts, | 163 | ... u'po/sr.po', 'foo', by_maintainer, rosetta_experts, |
478 | 164 | ... distroseries=hoary_distroseries, | 164 | ... distroseries=hoary_distroseries, |
479 | 165 | ... sourcepackagename=evolution_sourcepackagename) | 165 | ... sourcepackagename=evolution_sourcepackagename) |
480 | 166 | 166 | ||
481 | @@ -223,11 +223,11 @@ | |||
482 | 223 | >>> guessed_pofile == pofile | 223 | >>> guessed_pofile == pofile |
483 | 224 | True | 224 | True |
484 | 225 | 225 | ||
486 | 226 | And because it's an upstream upload, the IPOFile in our database got | 226 | And because it's an upload by the maintainer, the IPOFile in our database got |
487 | 227 | its path changed to the one noted by this upload instead of having the | 227 | its path changed to the one noted by this upload instead of having the |
488 | 228 | one we set a couple of lines ago (u'po/sr-old.pot'): | 228 | one we set a couple of lines ago (u'po/sr-old.pot'): |
489 | 229 | 229 | ||
491 | 230 | >>> po_sr_entry.from_upstream | 230 | >>> po_sr_entry.by_maintainer |
492 | 231 | True | 231 | True |
493 | 232 | >>> pofile.path == po_sr_entry.path | 232 | >>> pofile.path == po_sr_entry.path |
494 | 233 | True | 233 | True |
495 | @@ -1122,7 +1122,7 @@ | |||
496 | 1122 | ... } | 1122 | ... } |
497 | 1123 | >>> tarfile_content = LaunchpadWriteTarFile.files_to_string( | 1123 | >>> tarfile_content = LaunchpadWriteTarFile.files_to_string( |
498 | 1124 | ... test_tar_content) | 1124 | ... test_tar_content) |
500 | 1125 | >>> from_upstream = True | 1125 | >>> by_maintainer = True |
501 | 1126 | 1126 | ||
502 | 1127 | We will need this helper function to print the queue content. | 1127 | We will need this helper function to print the queue content. |
503 | 1128 | 1128 | ||
504 | @@ -1155,7 +1155,7 @@ | |||
505 | 1155 | product. There will be three new entries from the tarball. | 1155 | product. There will be three new entries from the tarball. |
506 | 1156 | 1156 | ||
507 | 1157 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( | 1157 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( |
509 | 1158 | ... tarfile_content, from_upstream, rosetta_experts, | 1158 | ... tarfile_content, by_maintainer, rosetta_experts, |
510 | 1159 | ... productseries=evolution_productseries, | 1159 | ... productseries=evolution_productseries, |
511 | 1160 | ... potemplate=evolution_22_test_template) | 1160 | ... potemplate=evolution_22_test_template) |
512 | 1161 | (3, []) | 1161 | (3, []) |
513 | @@ -1190,7 +1190,7 @@ | |||
514 | 1190 | Foo template | 1190 | Foo template |
515 | 1191 | 1191 | ||
516 | 1192 | >>> entry = translationimportqueue.addOrUpdateEntry( | 1192 | >>> entry = translationimportqueue.addOrUpdateEntry( |
518 | 1193 | ... "foo.pot", "New content", from_upstream, rosetta_experts, | 1193 | ... "foo.pot", "New content", by_maintainer, rosetta_experts, |
519 | 1194 | ... productseries=evolution_productseries, | 1194 | ... productseries=evolution_productseries, |
520 | 1195 | ... potemplate=evolution_22_test_template) | 1195 | ... potemplate=evolution_22_test_template) |
521 | 1196 | >>> entry = removeSecurityProxy(entry) | 1196 | >>> entry = removeSecurityProxy(entry) |
522 | @@ -1204,7 +1204,7 @@ | |||
523 | 1204 | on a best match basis. The entry is updated. | 1204 | on a best match basis. The entry is updated. |
524 | 1205 | 1205 | ||
525 | 1206 | >>> entry = translationimportqueue.addOrUpdateEntry( | 1206 | >>> entry = translationimportqueue.addOrUpdateEntry( |
527 | 1207 | ... "foo.pot", "Even newer content", from_upstream, rosetta_experts, | 1207 | ... "foo.pot", "Even newer content", by_maintainer, rosetta_experts, |
528 | 1208 | ... productseries=evolution_productseries) | 1208 | ... productseries=evolution_productseries) |
529 | 1209 | >>> entry = removeSecurityProxy(entry) | 1209 | >>> entry = removeSecurityProxy(entry) |
530 | 1210 | >>> transaction.commit() | 1210 | >>> transaction.commit() |
531 | @@ -1221,7 +1221,7 @@ | |||
532 | 1221 | Spanish translation | 1221 | Spanish translation |
533 | 1222 | 1222 | ||
534 | 1223 | >>> entry = removeSecurityProxy(translationimportqueue.addOrUpdateEntry( | 1223 | >>> entry = removeSecurityProxy(translationimportqueue.addOrUpdateEntry( |
536 | 1224 | ... "es.po", "New po content", from_upstream, rosetta_experts, | 1224 | ... "es.po", "New po content", by_maintainer, rosetta_experts, |
537 | 1225 | ... productseries=evolution_productseries)) | 1225 | ... productseries=evolution_productseries)) |
538 | 1226 | >>> transaction.commit() | 1226 | >>> transaction.commit() |
539 | 1227 | >>> entry is existing_entry | 1227 | >>> entry is existing_entry |
540 | @@ -1233,7 +1233,7 @@ | |||
541 | 1233 | we get again three more entries. | 1233 | we get again three more entries. |
542 | 1234 | 1234 | ||
543 | 1235 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( | 1235 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( |
545 | 1236 | ... tarfile_content, from_upstream, rosetta_experts, | 1236 | ... tarfile_content, by_maintainer, rosetta_experts, |
546 | 1237 | ... productseries=evolution_productseries, | 1237 | ... productseries=evolution_productseries, |
547 | 1238 | ... potemplate=evolution_22_template) | 1238 | ... potemplate=evolution_22_template) |
548 | 1239 | (3, []) | 1239 | (3, []) |
549 | @@ -1256,7 +1256,7 @@ | |||
550 | 1256 | updated. | 1256 | updated. |
551 | 1257 | 1257 | ||
552 | 1258 | >>> print queue.addOrUpdateEntry( | 1258 | >>> print queue.addOrUpdateEntry( |
554 | 1259 | ... "foo.pot", "Latest content", from_upstream, rosetta_experts, | 1259 | ... "foo.pot", "Latest content", by_maintainer, rosetta_experts, |
555 | 1260 | ... productseries=evolution_productseries) | 1260 | ... productseries=evolution_productseries) |
556 | 1261 | None | 1261 | None |
557 | 1262 | 1262 | ||
558 | @@ -1264,11 +1264,11 @@ | |||
559 | 1264 | then to a specific template. | 1264 | then to a specific template. |
560 | 1265 | 1265 | ||
561 | 1266 | >>> existing_entry = queue.addOrUpdateEntry( | 1266 | >>> existing_entry = queue.addOrUpdateEntry( |
563 | 1267 | ... "bar.pot", "Bar content", from_upstream, rosetta_experts, | 1267 | ... "bar.pot", "Bar content", by_maintainer, rosetta_experts, |
564 | 1268 | ... productseries=evolution_productseries) | 1268 | ... productseries=evolution_productseries) |
565 | 1269 | >>> existing_entry = removeSecurityProxy(existing_entry) | 1269 | >>> existing_entry = removeSecurityProxy(existing_entry) |
566 | 1270 | >>> entry = queue.addOrUpdateEntry( | 1270 | >>> entry = queue.addOrUpdateEntry( |
568 | 1271 | ... "bar.pot", "Bar content", from_upstream, rosetta_experts, | 1271 | ... "bar.pot", "Bar content", by_maintainer, rosetta_experts, |
569 | 1272 | ... productseries=evolution_productseries, | 1272 | ... productseries=evolution_productseries, |
570 | 1273 | ... potemplate=evolution_22_template) | 1273 | ... potemplate=evolution_22_template) |
571 | 1274 | 1274 | ||
572 | @@ -1284,7 +1284,7 @@ | |||
573 | 1284 | When uploading to the prouct now, the best matching entry is updated. | 1284 | When uploading to the prouct now, the best matching entry is updated. |
574 | 1285 | 1285 | ||
575 | 1286 | >>> entry = queue.addOrUpdateEntry( | 1286 | >>> entry = queue.addOrUpdateEntry( |
577 | 1287 | ... "bar.pot", "New bar content", from_upstream, rosetta_experts, | 1287 | ... "bar.pot", "New bar content", by_maintainer, rosetta_experts, |
578 | 1288 | ... productseries=evolution_productseries) | 1288 | ... productseries=evolution_productseries) |
579 | 1289 | >>> entry = removeSecurityProxy(entry) | 1289 | >>> entry = removeSecurityProxy(entry) |
580 | 1290 | >>> transaction.commit() | 1290 | >>> transaction.commit() |
581 | @@ -1321,7 +1321,7 @@ | |||
582 | 1321 | filter, so there seem to be only 2 files in the tarball. | 1321 | filter, so there seem to be only 2 files in the tarball. |
583 | 1322 | 1322 | ||
584 | 1323 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( | 1323 | >>> translationimportqueue.addOrUpdateEntriesFromTarball( |
586 | 1324 | ... tarfile_content, from_upstream, rosetta_experts, | 1324 | ... tarfile_content, by_maintainer, rosetta_experts, |
587 | 1325 | ... productseries=netapplet_trunk, | 1325 | ... productseries=netapplet_trunk, |
588 | 1326 | ... filename_filter=swizzle_filename) | 1326 | ... filename_filter=swizzle_filename) |
589 | 1327 | (2, []) | 1327 | (2, []) |
590 | 1328 | 1328 | ||
591 | === modified file 'lib/lp/translations/interfaces/translationimportqueue.py' | |||
592 | --- lib/lp/translations/interfaces/translationimportqueue.py 2010-11-05 08:11:53 +0000 | |||
593 | +++ lib/lp/translations/interfaces/translationimportqueue.py 2010-11-09 12:03:48 +0000 | |||
594 | @@ -175,8 +175,10 @@ | |||
595 | 175 | required=False, | 175 | required=False, |
596 | 176 | vocabulary="SourcePackageName") | 176 | vocabulary="SourcePackageName") |
597 | 177 | 177 | ||
600 | 178 | from_upstream = Bool( | 178 | by_maintainer = Bool( |
601 | 179 | title=_("This import comes from an upstream project."), | 179 | title=_( |
602 | 180 | "This upload was done by the maintainer " | ||
603 | 181 | "of the project or package."), | ||
604 | 180 | description=_( | 182 | description=_( |
605 | 181 | "If checked, the translations in this import will be marked " | 183 | "If checked, the translations in this import will be marked " |
606 | 182 | "as is_current_upstream."), | 184 | "as is_current_upstream."), |
607 | @@ -309,15 +311,15 @@ | |||
608 | 309 | def countEntries(): | 311 | def countEntries(): |
609 | 310 | """Return the number of `TranslationImportQueueEntry` records.""" | 312 | """Return the number of `TranslationImportQueueEntry` records.""" |
610 | 311 | 313 | ||
612 | 312 | def addOrUpdateEntry(path, content, from_upstream, importer, | 314 | def addOrUpdateEntry(path, content, by_maintainer, importer, |
613 | 313 | sourcepackagename=None, distroseries=None, productseries=None, | 315 | sourcepackagename=None, distroseries=None, productseries=None, |
614 | 314 | potemplate=None, pofile=None, format=None): | 316 | potemplate=None, pofile=None, format=None): |
615 | 315 | """Return a new or updated entry of the import queue. | 317 | """Return a new or updated entry of the import queue. |
616 | 316 | 318 | ||
618 | 317 | :arg path: is the path, with the filename, of the file imported. | 319 | :arg path: is the path, with the filename, of the uploaded file. |
619 | 318 | :arg content: is the file content. | 320 | :arg content: is the file content. |
622 | 319 | :arg from_upstream: indicates if the imported file is coming from an | 321 | :arg by_maintainer: indicates if the file was uploaded by the |
623 | 320 | upstream project. | 322 | maintainer of the project or package. |
624 | 321 | :arg importer: is the person that did the import. | 323 | :arg importer: is the person that did the import. |
625 | 322 | :arg sourcepackagename: is the link of this import with source | 324 | :arg sourcepackagename: is the link of this import with source |
626 | 323 | package. | 325 | package. |
627 | @@ -332,14 +334,14 @@ | |||
628 | 332 | only one of them can be specified. | 334 | only one of them can be specified. |
629 | 333 | """ | 335 | """ |
630 | 334 | 336 | ||
632 | 335 | def addOrUpdateEntriesFromTarball(content, from_upstream, importer, | 337 | def addOrUpdateEntriesFromTarball(content, by_maintainer, importer, |
633 | 336 | sourcepackagename=None, distroseries=None, productseries=None, | 338 | sourcepackagename=None, distroseries=None, productseries=None, |
634 | 337 | potemplate=None, filename_filter=None, approver_factory=None): | 339 | potemplate=None, filename_filter=None, approver_factory=None): |
635 | 338 | """Add all .po or .pot files from the tarball at :content:. | 340 | """Add all .po or .pot files from the tarball at :content:. |
636 | 339 | 341 | ||
637 | 340 | :arg content: is a tarball stream. | 342 | :arg content: is a tarball stream. |
640 | 341 | :arg from_upstream: indicates if the imported file is coming from an | 343 | :arg by_maintainer: indicates if the file was uploaded by the |
641 | 342 | upstream project. | 344 | maintainer of the project or package. |
642 | 343 | :arg importer: is the person that did the import. | 345 | :arg importer: is the person that did the import. |
643 | 344 | :arg sourcepackagename: is the link of this import with source | 346 | :arg sourcepackagename: is the link of this import with source |
644 | 345 | package. | 347 | package. |
645 | 346 | 348 | ||
646 | === modified file 'lib/lp/translations/model/pofile.py' | |||
647 | --- lib/lp/translations/model/pofile.py 2010-11-09 06:55:07 +0000 | |||
648 | +++ lib/lp/translations/model/pofile.py 2010-11-09 12:03:48 +0000 | |||
649 | @@ -1185,10 +1185,10 @@ | |||
650 | 1185 | entry_to_import.setStatus( | 1185 | entry_to_import.setStatus( |
651 | 1186 | RosettaImportStatus.FAILED, rosetta_experts) | 1186 | RosettaImportStatus.FAILED, rosetta_experts) |
652 | 1187 | else: | 1187 | else: |
654 | 1188 | if (entry_to_import.from_upstream and | 1188 | if (entry_to_import.by_maintainer and |
655 | 1189 | not needs_notification_for_imported): | 1189 | not needs_notification_for_imported): |
658 | 1190 | # If it's an upstream upload (i.e. from a package or bzr | 1190 | # If it's an upload by the maintainer of the project or |
659 | 1191 | # branch), do not send success notifications unless they | 1191 | # package, do not send success notifications unless they |
660 | 1192 | # are needed. | 1192 | # are needed. |
661 | 1193 | subject = None | 1193 | subject = None |
662 | 1194 | 1194 | ||
663 | @@ -1196,8 +1196,8 @@ | |||
664 | 1196 | RosettaImportStatus.IMPORTED, rosetta_experts) | 1196 | RosettaImportStatus.IMPORTED, rosetta_experts) |
665 | 1197 | # Assign karma to the importer if this is not an automatic import | 1197 | # Assign karma to the importer if this is not an automatic import |
666 | 1198 | # (all automatic imports come from the rosetta expert user) and | 1198 | # (all automatic imports come from the rosetta expert user) and |
669 | 1199 | # comes from upstream. | 1199 | # was done by the maintainer. |
670 | 1200 | if (entry_to_import.from_upstream and | 1200 | if (entry_to_import.by_maintainer and |
671 | 1201 | entry_to_import.importer.id != rosetta_experts.id): | 1201 | entry_to_import.importer.id != rosetta_experts.id): |
672 | 1202 | entry_to_import.importer.assignKarma( | 1202 | entry_to_import.importer.assignKarma( |
673 | 1203 | 'translationimportupstream', | 1203 | 'translationimportupstream', |
674 | 1204 | 1204 | ||
675 | === modified file 'lib/lp/translations/model/translationimportqueue.py' | |||
676 | --- lib/lp/translations/model/translationimportqueue.py 2010-11-05 08:11:53 +0000 | |||
677 | +++ lib/lp/translations/model/translationimportqueue.py 2010-11-09 12:03:48 +0000 | |||
678 | @@ -156,7 +156,7 @@ | |||
679 | 156 | distroseries = Reference(distroseries_id, 'DistroSeries.id') | 156 | distroseries = Reference(distroseries_id, 'DistroSeries.id') |
680 | 157 | productseries_id = Int(name='productseries', allow_none=True) | 157 | productseries_id = Int(name='productseries', allow_none=True) |
681 | 158 | productseries = Reference(productseries_id, 'ProductSeries.id') | 158 | productseries = Reference(productseries_id, 'ProductSeries.id') |
683 | 159 | from_upstream = BoolCol(notNull=True) | 159 | by_maintainer = BoolCol(notNull=True) |
684 | 160 | pofile = ForeignKey(foreignKey='POFile', dbName='pofile', | 160 | pofile = ForeignKey(foreignKey='POFile', dbName='pofile', |
685 | 161 | notNull=False, default=None) | 161 | notNull=False, default=None) |
686 | 162 | potemplate = ForeignKey(foreignKey='POTemplate', | 162 | potemplate = ForeignKey(foreignKey='POTemplate', |
687 | @@ -485,12 +485,12 @@ | |||
688 | 485 | if pofile.canEditTranslations(self.importer): | 485 | if pofile.canEditTranslations(self.importer): |
689 | 486 | pofile.owner = self.importer | 486 | pofile.owner = self.importer |
690 | 487 | 487 | ||
697 | 488 | if self.from_upstream: | 488 | if self.by_maintainer: |
698 | 489 | # This entry comes from upstream, which means that the path we got | 489 | # This was uploaded by the maintainer, which means that the path |
699 | 490 | # is exactly the right one. If it's different from what pofile | 490 | # we got is exactly the right one. If it's different from what |
700 | 491 | # has, that would mean that either the entry changed its path | 491 | # pofile has, that would mean that either the entry changed its |
701 | 492 | # since previous upload or that we had to guess it and now that we | 492 | # path since previous upload or that we had to guess it and now |
702 | 493 | # got the right path, we should fix it. | 493 | # that we got the right path, we should fix it. |
703 | 494 | pofile.setPathIfUnique(self.path) | 494 | pofile.setPathIfUnique(self.path) |
704 | 495 | 495 | ||
705 | 496 | if (sourcepackagename is None and | 496 | if (sourcepackagename is None and |
706 | @@ -912,7 +912,7 @@ | |||
707 | 912 | return ( | 912 | return ( |
708 | 913 | format, translation_importer.getTranslationFormatImporter(format)) | 913 | format, translation_importer.getTranslationFormatImporter(format)) |
709 | 914 | 914 | ||
711 | 915 | def addOrUpdateEntry(self, path, content, from_upstream, importer, | 915 | def addOrUpdateEntry(self, path, content, by_maintainer, importer, |
712 | 916 | sourcepackagename=None, distroseries=None, | 916 | sourcepackagename=None, distroseries=None, |
713 | 917 | productseries=None, potemplate=None, pofile=None, | 917 | productseries=None, potemplate=None, pofile=None, |
714 | 918 | format=None): | 918 | format=None): |
715 | @@ -948,13 +948,13 @@ | |||
716 | 948 | entry = TranslationImportQueueEntry(path=path, content=alias, | 948 | entry = TranslationImportQueueEntry(path=path, content=alias, |
717 | 949 | importer=importer, sourcepackagename=sourcepackagename, | 949 | importer=importer, sourcepackagename=sourcepackagename, |
718 | 950 | distroseries=distroseries, productseries=productseries, | 950 | distroseries=distroseries, productseries=productseries, |
720 | 951 | from_upstream=from_upstream, potemplate=potemplate, | 951 | by_maintainer=by_maintainer, potemplate=potemplate, |
721 | 952 | pofile=pofile, format=format) | 952 | pofile=pofile, format=format) |
722 | 953 | else: | 953 | else: |
723 | 954 | # It's an update. | 954 | # It's an update. |
724 | 955 | entry.setErrorOutput(None) | 955 | entry.setErrorOutput(None) |
725 | 956 | entry.content = alias | 956 | entry.content = alias |
727 | 957 | entry.from_upstream = from_upstream | 957 | entry.by_maintainer = by_maintainer |
728 | 958 | if potemplate is not None: | 958 | if potemplate is not None: |
729 | 959 | # Only set the linked IPOTemplate object if it's not None. | 959 | # Only set the linked IPOTemplate object if it's not None. |
730 | 960 | entry.potemplate = potemplate | 960 | entry.potemplate = potemplate |
731 | @@ -1015,7 +1015,7 @@ | |||
732 | 1015 | 1015 | ||
733 | 1016 | return True | 1016 | return True |
734 | 1017 | 1017 | ||
736 | 1018 | def addOrUpdateEntriesFromTarball(self, content, from_upstream, importer, | 1018 | def addOrUpdateEntriesFromTarball(self, content, by_maintainer, importer, |
737 | 1019 | sourcepackagename=None, distroseries=None, productseries=None, | 1019 | sourcepackagename=None, distroseries=None, productseries=None, |
738 | 1020 | potemplate=None, filename_filter=None, approver_factory=None): | 1020 | potemplate=None, filename_filter=None, approver_factory=None): |
739 | 1021 | """See ITranslationImportQueue.""" | 1021 | """See ITranslationImportQueue.""" |
740 | @@ -1056,7 +1056,7 @@ | |||
741 | 1056 | 1056 | ||
742 | 1057 | path = upload_files[tarinfo.name] | 1057 | path = upload_files[tarinfo.name] |
743 | 1058 | entry = approver.approve(self.addOrUpdateEntry( | 1058 | entry = approver.approve(self.addOrUpdateEntry( |
745 | 1059 | path, file_content, from_upstream, importer, | 1059 | path, file_content, by_maintainer, importer, |
746 | 1060 | sourcepackagename=sourcepackagename, | 1060 | sourcepackagename=sourcepackagename, |
747 | 1061 | distroseries=distroseries, productseries=productseries, | 1061 | distroseries=distroseries, productseries=productseries, |
748 | 1062 | potemplate=potemplate)) | 1062 | potemplate=potemplate)) |
749 | 1063 | 1063 | ||
750 | === modified file 'lib/lp/translations/utilities/gettext_po_importer.py' | |||
751 | --- lib/lp/translations/utilities/gettext_po_importer.py 2010-08-23 08:35:29 +0000 | |||
752 | +++ lib/lp/translations/utilities/gettext_po_importer.py 2010-11-09 12:03:48 +0000 | |||
753 | @@ -32,7 +32,7 @@ | |||
754 | 32 | self.productseries = None | 32 | self.productseries = None |
755 | 33 | self.distroseries = None | 33 | self.distroseries = None |
756 | 34 | self.sourcepackagename = None | 34 | self.sourcepackagename = None |
758 | 35 | self.from_upstream = False | 35 | self.by_maintainer = False |
759 | 36 | self.content = None | 36 | self.content = None |
760 | 37 | 37 | ||
761 | 38 | def getFormat(self, file_contents): | 38 | def getFormat(self, file_contents): |
762 | @@ -55,7 +55,7 @@ | |||
763 | 55 | self.distroseries = translation_import_queue_entry.distroseries | 55 | self.distroseries = translation_import_queue_entry.distroseries |
764 | 56 | self.sourcepackagename = ( | 56 | self.sourcepackagename = ( |
765 | 57 | translation_import_queue_entry.sourcepackagename) | 57 | translation_import_queue_entry.sourcepackagename) |
767 | 58 | self.from_upstream = translation_import_queue_entry.from_upstream | 58 | self.by_maintainer = translation_import_queue_entry.by_maintainer |
768 | 59 | 59 | ||
769 | 60 | librarian_client = getUtility(ILibrarianClient) | 60 | librarian_client = getUtility(ILibrarianClient) |
770 | 61 | self.content = librarian_client.getFileByAlias( | 61 | self.content = librarian_client.getFileByAlias( |
771 | 62 | 62 | ||
772 | === modified file 'lib/lp/translations/utilities/mozilla_xpi_importer.py' | |||
773 | --- lib/lp/translations/utilities/mozilla_xpi_importer.py 2010-08-23 08:35:29 +0000 | |||
774 | +++ lib/lp/translations/utilities/mozilla_xpi_importer.py 2010-11-09 12:03:48 +0000 | |||
775 | @@ -380,7 +380,7 @@ | |||
776 | 380 | self.productseries = None | 380 | self.productseries = None |
777 | 381 | self.distroseries = None | 381 | self.distroseries = None |
778 | 382 | self.sourcepackagename = None | 382 | self.sourcepackagename = None |
780 | 383 | self.from_upstream = False | 383 | self.by_maintainer = False |
781 | 384 | self._translation_file = None | 384 | self._translation_file = None |
782 | 385 | 385 | ||
783 | 386 | def getFormat(self, file_contents): | 386 | def getFormat(self, file_contents): |
784 | @@ -406,7 +406,7 @@ | |||
785 | 406 | self.distroseries = translation_import_queue_entry.distroseries | 406 | self.distroseries = translation_import_queue_entry.distroseries |
786 | 407 | self.sourcepackagename = ( | 407 | self.sourcepackagename = ( |
787 | 408 | translation_import_queue_entry.sourcepackagename) | 408 | translation_import_queue_entry.sourcepackagename) |
789 | 409 | self.from_upstream = translation_import_queue_entry.from_upstream | 409 | self.by_maintainer = translation_import_queue_entry.by_maintainer |
790 | 410 | 410 | ||
791 | 411 | librarian_client = getUtility(ILibrarianClient) | 411 | librarian_client = getUtility(ILibrarianClient) |
792 | 412 | content = librarian_client.getFileByAlias( | 412 | content = librarian_client.getFileByAlias( |
793 | 413 | 413 | ||
794 | === modified file 'lib/lp/translations/utilities/tests/helpers.py' | |||
795 | --- lib/lp/translations/utilities/tests/helpers.py 2010-11-05 08:11:53 +0000 | |||
796 | +++ lib/lp/translations/utilities/tests/helpers.py 2010-11-09 12:03:48 +0000 | |||
797 | @@ -26,7 +26,7 @@ | |||
798 | 26 | 26 | ||
799 | 27 | 27 | ||
800 | 28 | def import_pofile_or_potemplate(file_contents, person, | 28 | def import_pofile_or_potemplate(file_contents, person, |
802 | 29 | pofile=None, potemplate=None, from_upstream=True): | 29 | pofile=None, potemplate=None, by_maintainer=True): |
803 | 30 | """Import a `POFile` or `POTemplate` from the given string. | 30 | """Import a `POFile` or `POTemplate` from the given string. |
804 | 31 | 31 | ||
805 | 32 | :param file_contents: text of "file" to import. | 32 | :param file_contents: text of "file" to import. |
806 | @@ -34,24 +34,26 @@ | |||
807 | 34 | :param pofile: if uploading a `POFile`, file to import to; None otherwise. | 34 | :param pofile: if uploading a `POFile`, file to import to; None otherwise. |
808 | 35 | :param potemplate: if uploading a `POTemplate`, file to import to; None | 35 | :param potemplate: if uploading a `POTemplate`, file to import to; None |
809 | 36 | otherwise. | 36 | otherwise. |
810 | 37 | :param by_maintainer: true if this file was uplaoded by the maintainer | ||
811 | 38 | of the project or package. | ||
812 | 37 | :return: `TranslationImportQueueEntry` as added to the import queue. | 39 | :return: `TranslationImportQueueEntry` as added to the import queue. |
813 | 38 | """ | 40 | """ |
814 | 39 | translation_import_queue = getUtility(ITranslationImportQueue) | 41 | translation_import_queue = getUtility(ITranslationImportQueue) |
815 | 40 | if pofile is not None: | 42 | if pofile is not None: |
816 | 41 | if pofile.potemplate.distroseries is None: | 43 | if pofile.potemplate.distroseries is None: |
817 | 42 | entry = translation_import_queue.addOrUpdateEntry( | 44 | entry = translation_import_queue.addOrUpdateEntry( |
819 | 43 | pofile.path, file_contents, from_upstream, person, | 45 | pofile.path, file_contents, by_maintainer, person, |
820 | 44 | productseries=pofile.potemplate.productseries, pofile=pofile) | 46 | productseries=pofile.potemplate.productseries, pofile=pofile) |
821 | 45 | else: | 47 | else: |
822 | 46 | entry = translation_import_queue.addOrUpdateEntry( | 48 | entry = translation_import_queue.addOrUpdateEntry( |
824 | 47 | pofile.path, file_contents, from_upstream, person, | 49 | pofile.path, file_contents, by_maintainer, person, |
825 | 48 | distroseries=pofile.potemplate.distroseries, | 50 | distroseries=pofile.potemplate.distroseries, |
826 | 49 | sourcepackagename=pofile.potemplate.sourcepackagename, | 51 | sourcepackagename=pofile.potemplate.sourcepackagename, |
827 | 50 | pofile=pofile) | 52 | pofile=pofile) |
828 | 51 | target = pofile | 53 | target = pofile |
829 | 52 | else: | 54 | else: |
832 | 53 | # A POTemplate can only be 'upstream', so setting the | 55 | # A POTemplate can only be uploaded by the maintainer, so setting the |
833 | 54 | # from_upstream flag makes no difference. | 56 | # by_maintainer flag makes no difference. |
834 | 55 | if potemplate.distroseries is None: | 57 | if potemplate.distroseries is None: |
835 | 56 | entry = translation_import_queue.addOrUpdateEntry( | 58 | entry = translation_import_queue.addOrUpdateEntry( |
836 | 57 | potemplate.path, file_contents, True, person, | 59 | potemplate.path, file_contents, True, person, |
837 | 58 | 60 | ||
838 | === modified file 'lib/lp/translations/utilities/tests/import-flags.txt' | |||
839 | --- lib/lp/translations/utilities/tests/import-flags.txt 2010-03-24 14:25:52 +0000 | |||
840 | +++ lib/lp/translations/utilities/tests/import-flags.txt 2010-11-09 12:03:48 +0000 | |||
841 | @@ -223,7 +223,7 @@ | |||
842 | 223 | 223 | ||
843 | 224 | >>> entry = import_pofile_or_potemplate(test_translation_update1, | 224 | >>> entry = import_pofile_or_potemplate(test_translation_update1, |
844 | 225 | ... carlos, pofile=firefox_serbian, | 225 | ... carlos, pofile=firefox_serbian, |
846 | 226 | ... from_upstream=False) | 226 | ... by_maintainer=False) |
847 | 227 | >>> print entry.status.name | 227 | >>> print entry.status.name |
848 | 228 | IMPORTED | 228 | IMPORTED |
849 | 229 | >>> flush_database_caches() | 229 | >>> flush_database_caches() |
850 | @@ -289,7 +289,7 @@ | |||
851 | 289 | 289 | ||
852 | 290 | >>> entry = import_pofile_or_potemplate(test_translation_imported_update, | 290 | >>> entry = import_pofile_or_potemplate(test_translation_imported_update, |
853 | 291 | ... carlos, pofile=firefox_serbian, | 291 | ... carlos, pofile=firefox_serbian, |
855 | 292 | ... from_upstream=True) | 292 | ... by_maintainer=True) |
856 | 293 | >>> print entry.status.name | 293 | >>> print entry.status.name |
857 | 294 | IMPORTED | 294 | IMPORTED |
858 | 295 | >>> flush_database_caches() | 295 | >>> flush_database_caches() |
859 | @@ -361,7 +361,7 @@ | |||
860 | 361 | 361 | ||
861 | 362 | >>> entry = import_pofile_or_potemplate(test_translation_update2, | 362 | >>> entry = import_pofile_or_potemplate(test_translation_update2, |
862 | 363 | ... carlos, pofile=firefox_serbian, | 363 | ... carlos, pofile=firefox_serbian, |
864 | 364 | ... from_upstream=False) | 364 | ... by_maintainer=False) |
865 | 365 | >>> print entry.status.name | 365 | >>> print entry.status.name |
866 | 366 | IMPORTED | 366 | IMPORTED |
867 | 367 | >>> flush_database_caches() | 367 | >>> flush_database_caches() |
868 | @@ -430,7 +430,7 @@ | |||
869 | 430 | 430 | ||
870 | 431 | >>> entry = import_pofile_or_potemplate(test_translation_update3, | 431 | >>> entry = import_pofile_or_potemplate(test_translation_update3, |
871 | 432 | ... carlos, pofile=firefox_serbian, | 432 | ... carlos, pofile=firefox_serbian, |
873 | 433 | ... from_upstream=False) | 433 | ... by_maintainer=False) |
874 | 434 | >>> print entry.status.name | 434 | >>> print entry.status.name |
875 | 435 | IMPORTED | 435 | IMPORTED |
876 | 436 | 436 | ||
877 | @@ -501,7 +501,7 @@ | |||
878 | 501 | 501 | ||
879 | 502 | >>> entry = import_pofile_or_potemplate(test_translation_update3, | 502 | >>> entry = import_pofile_or_potemplate(test_translation_update3, |
880 | 503 | ... carlos, pofile=firefox_serbian, | 503 | ... carlos, pofile=firefox_serbian, |
882 | 504 | ... from_upstream=False) | 504 | ... by_maintainer=False) |
883 | 505 | >>> print entry.status.name | 505 | >>> print entry.status.name |
884 | 506 | IMPORTED | 506 | IMPORTED |
885 | 507 | 507 | ||
886 | @@ -528,7 +528,7 @@ | |||
887 | 528 | 528 | ||
888 | 529 | >>> entry = import_pofile_or_potemplate(test_translation_update3, | 529 | >>> entry = import_pofile_or_potemplate(test_translation_update3, |
889 | 530 | ... carlos, pofile=firefox_serbian, | 530 | ... carlos, pofile=firefox_serbian, |
891 | 531 | ... from_upstream=True) | 531 | ... by_maintainer=True) |
892 | 532 | >>> print entry.status.name | 532 | >>> print entry.status.name |
893 | 533 | IMPORTED | 533 | IMPORTED |
894 | 534 | 534 | ||
895 | 535 | 535 | ||
896 | === modified file 'lib/lp/translations/utilities/tests/test_file_importer.py' | |||
897 | --- lib/lp/translations/utilities/tests/test_file_importer.py 2010-11-09 06:55:07 +0000 | |||
898 | +++ lib/lp/translations/utilities/tests/test_file_importer.py 2010-11-09 12:03:48 +0000 | |||
899 | @@ -116,29 +116,29 @@ | |||
900 | 116 | """Class test for translation importer component""" | 116 | """Class test for translation importer component""" |
901 | 117 | layer = ZopelessDatabaseLayer | 117 | layer = ZopelessDatabaseLayer |
902 | 118 | 118 | ||
904 | 119 | def _createFileImporters(self, pot_content, po_content, from_upstream): | 119 | def _createFileImporters(self, pot_content, po_content, by_maintainer): |
905 | 120 | """Create queue entries from POT and PO content strings. | 120 | """Create queue entries from POT and PO content strings. |
906 | 121 | Create importers from the entries.""" | 121 | Create importers from the entries.""" |
907 | 122 | pot_importer = self._createPOTFileImporter( | 122 | pot_importer = self._createPOTFileImporter( |
909 | 123 | pot_content, from_upstream) | 123 | pot_content, by_maintainer) |
910 | 124 | po_importer = self._createPOFileImporter( | 124 | po_importer = self._createPOFileImporter( |
912 | 125 | pot_importer, po_content, from_upstream) | 125 | pot_importer, po_content, by_maintainer) |
913 | 126 | return (pot_importer, po_importer) | 126 | return (pot_importer, po_importer) |
914 | 127 | 127 | ||
916 | 128 | def _createPOTFileImporter(self, pot_content, from_upstream): | 128 | def _createPOTFileImporter(self, pot_content, by_maintainer): |
917 | 129 | """Create queue entries from POT content string. | 129 | """Create queue entries from POT content string. |
918 | 130 | Create an importer from the entry.""" | 130 | Create an importer from the entry.""" |
919 | 131 | potemplate = self.factory.makePOTemplate() | 131 | potemplate = self.factory.makePOTemplate() |
920 | 132 | template_entry = self.translation_import_queue.addOrUpdateEntry( | 132 | template_entry = self.translation_import_queue.addOrUpdateEntry( |
921 | 133 | potemplate.path, pot_content, | 133 | potemplate.path, pot_content, |
923 | 134 | from_upstream, self.importer_person, | 134 | by_maintainer, self.importer_person, |
924 | 135 | productseries=potemplate.productseries, | 135 | productseries=potemplate.productseries, |
925 | 136 | potemplate=potemplate) | 136 | potemplate=potemplate) |
926 | 137 | self.fake_librarian.pretendCommit() | 137 | self.fake_librarian.pretendCommit() |
927 | 138 | return POTFileImporter(template_entry, GettextPOImporter(), None) | 138 | return POTFileImporter(template_entry, GettextPOImporter(), None) |
928 | 139 | 139 | ||
929 | 140 | def _createPOFileImporter(self, | 140 | def _createPOFileImporter(self, |
931 | 141 | pot_importer, po_content, from_upstream, existing_pofile=None, | 141 | pot_importer, po_content, by_maintainer, existing_pofile=None, |
932 | 142 | person=None): | 142 | person=None): |
933 | 143 | """Create a PO entry from content, relating to a template_entry. | 143 | """Create a PO entry from content, relating to a template_entry. |
934 | 144 | Create an importer for the entry.""" | 144 | Create an importer for the entry.""" |
935 | @@ -150,7 +150,7 @@ | |||
936 | 150 | pofile = existing_pofile | 150 | pofile = existing_pofile |
937 | 151 | person = person or self.importer_person | 151 | person = person or self.importer_person |
938 | 152 | translation_entry = self.translation_import_queue.addOrUpdateEntry( | 152 | translation_entry = self.translation_import_queue.addOrUpdateEntry( |
940 | 153 | pofile.path, po_content, from_upstream, person, | 153 | pofile.path, po_content, by_maintainer, person, |
941 | 154 | productseries=potemplate.productseries, pofile=pofile) | 154 | productseries=potemplate.productseries, pofile=pofile) |
942 | 155 | self.fake_librarian.pretendCommit() | 155 | self.fake_librarian.pretendCommit() |
943 | 156 | return POFileImporter(translation_entry, GettextPOImporter(), None) | 156 | return POFileImporter(translation_entry, GettextPOImporter(), None) |
944 | @@ -232,14 +232,14 @@ | |||
945 | 232 | "FileImporter.getOrCreatePOTMessageSet did not get an existing " | 232 | "FileImporter.getOrCreatePOTMessageSet did not get an existing " |
946 | 233 | "IPOTMsgSet object from the database.") | 233 | "IPOTMsgSet object from the database.") |
947 | 234 | 234 | ||
949 | 235 | def _test_storeTranslationsInDatabase_empty(self, from_upstream=True): | 235 | def _test_storeTranslationsInDatabase_empty(self, by_maintainer=True): |
950 | 236 | """Check whether we store empty messages appropriately.""" | 236 | """Check whether we store empty messages appropriately.""" |
951 | 237 | # Construct a POFile importer. | 237 | # Construct a POFile importer. |
952 | 238 | pot_importer = self._createPOTFileImporter( | 238 | pot_importer = self._createPOTFileImporter( |
954 | 239 | TEST_TEMPLATE_EXPORTED, from_upstream=True) | 239 | TEST_TEMPLATE_EXPORTED, by_maintainer=True) |
955 | 240 | importer = self._createPOFileImporter( | 240 | importer = self._createPOFileImporter( |
956 | 241 | pot_importer, TEST_TRANSLATION_EXPORTED, | 241 | pot_importer, TEST_TRANSLATION_EXPORTED, |
958 | 242 | from_upstream=from_upstream, person=self.importer_person) | 242 | by_maintainer=by_maintainer, person=self.importer_person) |
959 | 243 | 243 | ||
960 | 244 | # Empty message to import. | 244 | # Empty message to import. |
961 | 245 | message = TranslationMessageData() | 245 | message = TranslationMessageData() |
962 | @@ -253,12 +253,12 @@ | |||
963 | 253 | self.assertIs(None, translation) | 253 | self.assertIs(None, translation) |
964 | 254 | 254 | ||
965 | 255 | def test_storeTranslationsInDatabase_empty_imported(self): | 255 | def test_storeTranslationsInDatabase_empty_imported(self): |
968 | 256 | """Storing empty messages for published imports appropriately.""" | 256 | """Storing empty messages for maintainer uploads appropriately.""" |
969 | 257 | self._test_storeTranslationsInDatabase_empty(from_upstream=True) | 257 | self._test_storeTranslationsInDatabase_empty(by_maintainer=True) |
970 | 258 | 258 | ||
971 | 259 | def test_storeTranslationsInDatabase_empty_user(self): | 259 | def test_storeTranslationsInDatabase_empty_user(self): |
972 | 260 | """Store empty messages for user uploads appropriately.""" | 260 | """Store empty messages for user uploads appropriately.""" |
974 | 261 | self._test_storeTranslationsInDatabase_empty(from_upstream=False) | 261 | self._test_storeTranslationsInDatabase_empty(by_maintainer=False) |
975 | 262 | 262 | ||
976 | 263 | def test_FileImporter_storeTranslationsInDatabase_privileges(self): | 263 | def test_FileImporter_storeTranslationsInDatabase_privileges(self): |
977 | 264 | """Test `storeTranslationsInDatabase` privileges.""" | 264 | """Test `storeTranslationsInDatabase` privileges.""" |
978 | @@ -292,7 +292,7 @@ | |||
979 | 292 | context=message.context)) | 292 | context=message.context)) |
980 | 293 | 293 | ||
981 | 294 | po_importer = self._createPOFileImporter( | 294 | po_importer = self._createPOFileImporter( |
983 | 295 | pot_importer, TEST_TRANSLATION_EXPORTED, from_upstream=True, | 295 | pot_importer, TEST_TRANSLATION_EXPORTED, by_maintainer=True, |
984 | 296 | person=unprivileged_person) | 296 | person=unprivileged_person) |
985 | 297 | 297 | ||
986 | 298 | entry = removeSecurityProxy( | 298 | entry = removeSecurityProxy( |
987 | @@ -543,7 +543,7 @@ | |||
988 | 543 | self.translation_import_queue = getUtility(ITranslationImportQueue) | 543 | self.translation_import_queue = getUtility(ITranslationImportQueue) |
989 | 544 | self.importer_person = self.factory.makePerson() | 544 | self.importer_person = self.factory.makePerson() |
990 | 545 | 545 | ||
992 | 546 | def _make_queue_entry(self, from_upstream): | 546 | def _make_queue_entry(self, by_maintainer): |
993 | 547 | pofile = self.factory.makePOFile('eo') | 547 | pofile = self.factory.makePOFile('eo') |
994 | 548 | # Create a header with a newer date than what is found in | 548 | # Create a header with a newer date than what is found in |
995 | 549 | # TEST_TRANSLATION_FILE. | 549 | # TEST_TRANSLATION_FILE. |
996 | @@ -551,7 +551,7 @@ | |||
997 | 551 | "Content-Type: text/plain; charset=UTF-8\n") | 551 | "Content-Type: text/plain; charset=UTF-8\n") |
998 | 552 | po_content = TEST_TRANSLATION_FILE % ("", "foo", "bar") | 552 | po_content = TEST_TRANSLATION_FILE % ("", "foo", "bar") |
999 | 553 | queue_entry = self.translation_import_queue.addOrUpdateEntry( | 553 | queue_entry = self.translation_import_queue.addOrUpdateEntry( |
1001 | 554 | pofile.path, po_content, from_upstream, self.importer_person, | 554 | pofile.path, po_content, by_maintainer, self.importer_person, |
1002 | 555 | productseries=pofile.potemplate.productseries, pofile=pofile) | 555 | productseries=pofile.potemplate.productseries, pofile=pofile) |
1003 | 556 | self.fake_librarian.pretendCommit() | 556 | self.fake_librarian.pretendCommit() |
1004 | 557 | return queue_entry | 557 | return queue_entry |
1005 | @@ -609,7 +609,7 @@ | |||
1006 | 609 | self.upstream_template = self.factory.makePOTemplate( | 609 | self.upstream_template = self.factory.makePOTemplate( |
1007 | 610 | productseries=self.upstream_productseries) | 610 | productseries=self.upstream_productseries) |
1008 | 611 | 611 | ||
1010 | 612 | def _makeImportEntry(self, side, from_upstream=False, uploader=None, | 612 | def _makeImportEntry(self, side, by_maintainer=False, uploader=None, |
1011 | 613 | no_upstream=False): | 613 | no_upstream=False): |
1012 | 614 | if side == self.UPSTREAM: | 614 | if side == self.UPSTREAM: |
1013 | 615 | potemplate = self.upstream_template | 615 | potemplate = self.upstream_template |
1014 | @@ -636,7 +636,7 @@ | |||
1015 | 636 | pofile = self.factory.makePOFile( | 636 | pofile = self.factory.makePOFile( |
1016 | 637 | self.language.code, potemplate=potemplate, create_sharing=True) | 637 | self.language.code, potemplate=potemplate, create_sharing=True) |
1017 | 638 | entry = self.factory.makeTranslationImportQueueEntry( | 638 | entry = self.factory.makeTranslationImportQueueEntry( |
1019 | 639 | potemplate=potemplate, from_upstream=from_upstream, | 639 | potemplate=potemplate, by_maintainer=by_maintainer, |
1020 | 640 | uploader=uploader, content=self.POFILE) | 640 | uploader=uploader, content=self.POFILE) |
1021 | 641 | entry.potemplate = potemplate | 641 | entry.potemplate = potemplate |
1022 | 642 | entry.pofile = pofile | 642 | entry.pofile = pofile |
1023 | @@ -694,7 +694,7 @@ | |||
1024 | 694 | def test_share_with_other_side_ubuntu_from_package(self): | 694 | def test_share_with_other_side_ubuntu_from_package(self): |
1025 | 695 | # An ubuntu queue entry that is imported from an upstream package | 695 | # An ubuntu queue entry that is imported from an upstream package |
1026 | 696 | # will be shared with upstream. | 696 | # will be shared with upstream. |
1028 | 697 | entry = self._makeImportEntry(self.UBUNTU, from_upstream=True) | 697 | entry = self._makeImportEntry(self.UBUNTU, by_maintainer=True) |
1029 | 698 | importer = POFileImporter( | 698 | importer = POFileImporter( |
1030 | 699 | entry, importers[TranslationFileFormat.PO], None) | 699 | entry, importers[TranslationFileFormat.PO], None) |
1031 | 700 | self.assertTrue( | 700 | self.assertTrue( |
1032 | 701 | 701 | ||
1033 | === modified file 'lib/lp/translations/utilities/tests/test_gettext_po_importer.py' | |||
1034 | --- lib/lp/translations/utilities/tests/test_gettext_po_importer.py 2010-10-18 16:36:46 +0000 | |||
1035 | +++ lib/lp/translations/utilities/tests/test_gettext_po_importer.py 2010-11-09 12:03:48 +0000 | |||
1036 | @@ -57,20 +57,20 @@ | |||
1037 | 57 | # Add a new entry for testing purposes. It's a template one. | 57 | # Add a new entry for testing purposes. It's a template one. |
1038 | 58 | self.translation_import_queue = getUtility(ITranslationImportQueue) | 58 | self.translation_import_queue = getUtility(ITranslationImportQueue) |
1039 | 59 | template_path = 'po/testing.pot' | 59 | template_path = 'po/testing.pot' |
1041 | 60 | from_upstream = True | 60 | by_maintainer = True |
1042 | 61 | personset = getUtility(IPersonSet) | 61 | personset = getUtility(IPersonSet) |
1043 | 62 | importer = personset.getByName('carlos') | 62 | importer = personset.getByName('carlos') |
1044 | 63 | productset = getUtility(IProductSet) | 63 | productset = getUtility(IProductSet) |
1045 | 64 | firefox = productset.getByName('firefox') | 64 | firefox = productset.getByName('firefox') |
1046 | 65 | productseries = firefox.getSeries('trunk') | 65 | productseries = firefox.getSeries('trunk') |
1047 | 66 | template_entry = self.translation_import_queue.addOrUpdateEntry( | 66 | template_entry = self.translation_import_queue.addOrUpdateEntry( |
1049 | 67 | template_path, test_template, from_upstream, importer, | 67 | template_path, test_template, by_maintainer, importer, |
1050 | 68 | productseries=productseries) | 68 | productseries=productseries) |
1051 | 69 | 69 | ||
1052 | 70 | # Add another one, a translation file. | 70 | # Add another one, a translation file. |
1053 | 71 | pofile_path = 'po/es.po' | 71 | pofile_path = 'po/es.po' |
1054 | 72 | translation_entry = self.translation_import_queue.addOrUpdateEntry( | 72 | translation_entry = self.translation_import_queue.addOrUpdateEntry( |
1056 | 73 | pofile_path, test_translation_file, from_upstream, importer, | 73 | pofile_path, test_translation_file, by_maintainer, importer, |
1057 | 74 | productseries=productseries) | 74 | productseries=productseries) |
1058 | 75 | 75 | ||
1059 | 76 | transaction.commit() | 76 | transaction.commit() |
1060 | 77 | 77 | ||
1061 | === modified file 'lib/lp/translations/utilities/tests/test_kde_po_importer.py' | |||
1062 | --- lib/lp/translations/utilities/tests/test_kde_po_importer.py 2010-10-18 16:36:46 +0000 | |||
1063 | +++ lib/lp/translations/utilities/tests/test_kde_po_importer.py 2010-11-09 12:03:48 +0000 | |||
1064 | @@ -71,20 +71,20 @@ | |||
1065 | 71 | # Add a new entry for testing purposes. It's a template one. | 71 | # Add a new entry for testing purposes. It's a template one. |
1066 | 72 | self.translation_import_queue = getUtility(ITranslationImportQueue) | 72 | self.translation_import_queue = getUtility(ITranslationImportQueue) |
1067 | 73 | template_path = 'po/testing.pot' | 73 | template_path = 'po/testing.pot' |
1069 | 74 | from_upstream = True | 74 | by_maintainer = True |
1070 | 75 | personset = getUtility(IPersonSet) | 75 | personset = getUtility(IPersonSet) |
1071 | 76 | importer = personset.getByName('carlos') | 76 | importer = personset.getByName('carlos') |
1072 | 77 | productset = getUtility(IProductSet) | 77 | productset = getUtility(IProductSet) |
1073 | 78 | firefox = productset.getByName('firefox') | 78 | firefox = productset.getByName('firefox') |
1074 | 79 | firefox_trunk = firefox.getSeries('trunk') | 79 | firefox_trunk = firefox.getSeries('trunk') |
1075 | 80 | template_entry = self.translation_import_queue.addOrUpdateEntry( | 80 | template_entry = self.translation_import_queue.addOrUpdateEntry( |
1077 | 81 | template_path, test_kde_template, from_upstream, importer, | 81 | template_path, test_kde_template, by_maintainer, importer, |
1078 | 82 | productseries=firefox_trunk) | 82 | productseries=firefox_trunk) |
1079 | 83 | 83 | ||
1080 | 84 | # Add another one, a translation file. | 84 | # Add another one, a translation file. |
1081 | 85 | pofile_path = 'po/sr.po' | 85 | pofile_path = 'po/sr.po' |
1082 | 86 | translation_entry = self.translation_import_queue.addOrUpdateEntry( | 86 | translation_entry = self.translation_import_queue.addOrUpdateEntry( |
1084 | 87 | pofile_path, test_kde_translation_file, from_upstream, importer, | 87 | pofile_path, test_kde_translation_file, by_maintainer, importer, |
1085 | 88 | productseries=firefox_trunk) | 88 | productseries=firefox_trunk) |
1086 | 89 | 89 | ||
1087 | 90 | # Add a non-KDE PO file which gets recognized as regular PO file | 90 | # Add a non-KDE PO file which gets recognized as regular PO file |
1088 | @@ -93,7 +93,7 @@ | |||
1089 | 93 | firefox_10 = firefox.getSeries('1.0') | 93 | firefox_10 = firefox.getSeries('1.0') |
1090 | 94 | gettext_template_entry = ( | 94 | gettext_template_entry = ( |
1091 | 95 | self.translation_import_queue.addOrUpdateEntry( | 95 | self.translation_import_queue.addOrUpdateEntry( |
1093 | 96 | template_path, test_template, from_upstream, importer, | 96 | template_path, test_template, by_maintainer, importer, |
1094 | 97 | productseries=firefox_10)) | 97 | productseries=firefox_10)) |
1095 | 98 | 98 | ||
1096 | 99 | transaction.commit() | 99 | transaction.commit() |
1097 | 100 | 100 | ||
1098 | === modified file 'lib/lp/translations/utilities/tests/test_xpi_import.py' | |||
1099 | --- lib/lp/translations/utilities/tests/test_xpi_import.py 2010-11-05 08:11:53 +0000 | |||
1100 | +++ lib/lp/translations/utilities/tests/test_xpi_import.py 2010-11-09 12:03:48 +0000 | |||
1101 | @@ -77,7 +77,7 @@ | |||
1102 | 77 | file_contents=es_xpi.read(), | 77 | file_contents=es_xpi.read(), |
1103 | 78 | person=self.importer, | 78 | person=self.importer, |
1104 | 79 | pofile=self.spanish_firefox, | 79 | pofile=self.spanish_firefox, |
1106 | 80 | from_upstream=True) | 80 | by_maintainer=True) |
1107 | 81 | 81 | ||
1108 | 82 | def _assertXpiMessageInvariant(self, message): | 82 | def _assertXpiMessageInvariant(self, message): |
1109 | 83 | """Check whether invariant part of all messages are correct.""" | 83 | """Check whether invariant part of all messages are correct.""" |
1110 | 84 | 84 | ||
1111 | === modified file 'lib/lp/translations/utilities/tests/test_xpi_po_exporter.py' | |||
1112 | --- lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2010-11-05 08:11:53 +0000 | |||
1113 | +++ lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2010-11-09 12:03:48 +0000 | |||
1114 | @@ -81,9 +81,9 @@ | |||
1115 | 81 | 81 | ||
1116 | 82 | # Attach it to the import queue. | 82 | # Attach it to the import queue. |
1117 | 83 | translation_import_queue = getUtility(ITranslationImportQueue) | 83 | translation_import_queue = getUtility(ITranslationImportQueue) |
1119 | 84 | from_upstream = True | 84 | by_maintainer = True |
1120 | 85 | entry = translation_import_queue.addOrUpdateEntry( | 85 | entry = translation_import_queue.addOrUpdateEntry( |
1122 | 86 | self.firefox_template.path, en_US_xpi.read(), from_upstream, | 86 | self.firefox_template.path, en_US_xpi.read(), by_maintainer, |
1123 | 87 | self.importer, productseries=self.firefox_template.productseries, | 87 | self.importer, productseries=self.firefox_template.productseries, |
1124 | 88 | potemplate=self.firefox_template) | 88 | potemplate=self.firefox_template) |
1125 | 89 | 89 | ||
1126 | 90 | 90 | ||
1127 | === modified file 'lib/lp/translations/utilities/translation_import.py' | |||
1128 | --- lib/lp/translations/utilities/translation_import.py 2010-11-05 08:11:53 +0000 | |||
1129 | +++ lib/lp/translations/utilities/translation_import.py 2010-11-09 12:03:48 +0000 | |||
1130 | @@ -466,8 +466,8 @@ | |||
1131 | 466 | ITranslationSideTraitsSet).getForTemplate(self.potemplate) | 466 | ITranslationSideTraitsSet).getForTemplate(self.potemplate) |
1132 | 467 | if traits.side == TranslationSide.UPSTREAM: | 467 | if traits.side == TranslationSide.UPSTREAM: |
1133 | 468 | return True | 468 | return True |
1136 | 469 | # Check from_upstream. | 469 | # Maintainer uploads are always shared with Ubuntu. |
1137 | 470 | if self.translation_import_queue_entry.from_upstream: | 470 | if self.translation_import_queue_entry.by_maintainer: |
1138 | 471 | return True | 471 | return True |
1139 | 472 | # Find the sharing POFile and check permissions. | 472 | # Find the sharing POFile and check permissions. |
1140 | 473 | productseries = self.potemplate.distroseries.getSourcePackage( | 473 | productseries = self.potemplate.distroseries.getSourcePackage( |
1141 | @@ -498,8 +498,8 @@ | |||
1142 | 498 | self.pofile.language.code == 'en') | 498 | self.pofile.language.code == 'en') |
1143 | 499 | 499 | ||
1144 | 500 | def _storeCredits(self, potmsgset, credits): | 500 | def _storeCredits(self, potmsgset, credits): |
1147 | 501 | """Store credits but only from upstream.""" | 501 | """Store credits but only those provided by the maintainer.""" |
1148 | 502 | if not self.translation_import_queue_entry.from_upstream: | 502 | if not self.translation_import_queue_entry.by_maintainer: |
1149 | 503 | return None | 503 | return None |
1150 | 504 | return potmsgset.setCurrentTranslation( | 504 | return potmsgset.setCurrentTranslation( |
1151 | 505 | self.pofile, self.last_translator, credits, | 505 | self.pofile, self.last_translator, credits, |
1152 | @@ -585,7 +585,7 @@ | |||
1153 | 585 | if validation_ok and self.is_editor: | 585 | if validation_ok and self.is_editor: |
1154 | 586 | return self._approveMessage(potmsgset, new_message, message_data) | 586 | return self._approveMessage(potmsgset, new_message, message_data) |
1155 | 587 | 587 | ||
1157 | 588 | if self.translation_import_queue_entry.from_upstream: | 588 | if self.translation_import_queue_entry.by_maintainer: |
1158 | 589 | # XXX: henninge 2010-09-21: Mixed models! | 589 | # XXX: henninge 2010-09-21: Mixed models! |
1159 | 590 | # This is mimicking the old behavior to still mark these messages | 590 | # This is mimicking the old behavior to still mark these messages |
1160 | 591 | # as "imported". Will have to be removed when | 591 | # as "imported". Will have to be removed when |
1161 | @@ -754,7 +754,7 @@ | |||
1162 | 754 | # Update translation_message's comments and flags. | 754 | # Update translation_message's comments and flags. |
1163 | 755 | if translation_message is not None: | 755 | if translation_message is not None: |
1164 | 756 | translation_message.comment = message.comment | 756 | translation_message.comment = message.comment |
1166 | 757 | if self.translation_import_queue_entry.from_upstream: | 757 | if self.translation_import_queue_entry.by_maintainer: |
1167 | 758 | translation_message.was_obsolete_in_last_import = ( | 758 | translation_message.was_obsolete_in_last_import = ( |
1168 | 759 | message.is_obsolete) | 759 | message.is_obsolete) |
1169 | 760 | 760 | ||
1170 | @@ -779,10 +779,10 @@ | |||
1171 | 779 | if upload_header is not None: | 779 | if upload_header is not None: |
1172 | 780 | # Check whether we are importing a new version. | 780 | # Check whether we are importing a new version. |
1173 | 781 | if self.pofile.isTranslationRevisionDateOlder(upload_header): | 781 | if self.pofile.isTranslationRevisionDateOlder(upload_header): |
1178 | 782 | if translation_import_queue_entry.from_upstream: | 782 | if translation_import_queue_entry.by_maintainer: |
1179 | 783 | # Upstream files can be older than the last import | 783 | # Files uploaded by the maintainer can be older than the |
1180 | 784 | # and still be imported. They don't update header | 784 | # last import and still be imported. They don't update |
1181 | 785 | # information, though, so this is deleted here. | 785 | # header information, though, so this is deleted here. |
1182 | 786 | self.translation_file.header = None | 786 | self.translation_file.header = None |
1183 | 787 | else: | 787 | else: |
1184 | 788 | # The new imported file is older than latest one imported, | 788 | # The new imported file is older than latest one imported, |
1185 | @@ -802,10 +802,10 @@ | |||
1186 | 802 | self.lock_timestamp = ( | 802 | self.lock_timestamp = ( |
1187 | 803 | upload_header.launchpad_export_date) | 803 | upload_header.launchpad_export_date) |
1188 | 804 | 804 | ||
1190 | 805 | if (not self.translation_import_queue_entry.from_upstream and | 805 | if (not self.translation_import_queue_entry.by_maintainer and |
1191 | 806 | self.lock_timestamp is None): | 806 | self.lock_timestamp is None): |
1192 | 807 | # We got a translation file from offline translation (not from | 807 | # We got a translation file from offline translation (not from |
1194 | 808 | # upstream) and it misses the export time so we don't have a | 808 | # the maintainer) and it misses the export time so we don't have a |
1195 | 809 | # way to figure whether someone changed the same translations | 809 | # way to figure whether someone changed the same translations |
1196 | 810 | # while the offline work was done. | 810 | # while the offline work was done. |
1197 | 811 | raise NotExportedFromLaunchpad | 811 | raise NotExportedFromLaunchpad |
1198 | @@ -824,11 +824,10 @@ | |||
1199 | 824 | self.last_translator = ( | 824 | self.last_translator = ( |
1200 | 825 | self.translation_import_queue_entry.importer) | 825 | self.translation_import_queue_entry.importer) |
1201 | 826 | 826 | ||
1207 | 827 | if self.translation_import_queue_entry.from_upstream: | 827 | if self.translation_import_queue_entry.by_maintainer: |
1208 | 828 | # An unprivileged user wouldn't have been able to upload an | 828 | # The maintainer always has edit rights. |
1209 | 829 | # upstream file in the first place. But for Soyuz uploads, | 829 | # For Soyuz uploads, the "importer" reflects the package upload |
1210 | 830 | # the "importer" reflects the package upload, not the | 830 | # not the translations upload. |
1206 | 831 | # translations upload. So don't check for editing rights. | ||
1211 | 832 | self.is_editor = True | 831 | self.is_editor = True |
1212 | 833 | else: | 832 | else: |
1213 | 834 | # Use the importer rights to make sure the imported | 833 | # Use the importer rights to make sure the imported |
1214 | @@ -838,9 +837,9 @@ | |||
1215 | 838 | self.pofile.canEditTranslations( | 837 | self.pofile.canEditTranslations( |
1216 | 839 | self.translation_import_queue_entry.importer)) | 838 | self.translation_import_queue_entry.importer)) |
1217 | 840 | 839 | ||
1219 | 841 | from_upstream = self.translation_import_queue_entry.from_upstream | 840 | by_maintainer = self.translation_import_queue_entry.by_maintainer |
1220 | 842 | self.pofile_in_db = ExistingPOFileInDatabase( | 841 | self.pofile_in_db = ExistingPOFileInDatabase( |
1222 | 843 | self.pofile, is_current_upstream=from_upstream) | 842 | self.pofile, is_current_upstream=by_maintainer) |
1223 | 844 | 843 | ||
1224 | 845 | def _getPersonByEmail(self, email, name=None): | 844 | def _getPersonByEmail(self, email, name=None): |
1225 | 846 | """Return the person for given email. | 845 | """Return the person for given email. |
1226 | @@ -874,7 +873,7 @@ | |||
1227 | 874 | """See FileImporter.""" | 873 | """See FileImporter.""" |
1228 | 875 | # Mark this message as seen in the import | 874 | # Mark this message as seen in the import |
1229 | 876 | self.pofile_in_db.markMessageAsSeen(message) | 875 | self.pofile_in_db.markMessageAsSeen(message) |
1231 | 877 | if self.translation_import_queue_entry.from_upstream: | 876 | if self.translation_import_queue_entry.by_maintainer: |
1232 | 878 | if self.pofile_in_db.isAlreadyTranslatedTheSameUpstream(message): | 877 | if self.pofile_in_db.isAlreadyTranslatedTheSameUpstream(message): |
1233 | 879 | return | 878 | return |
1234 | 880 | else: | 879 | else: |
1235 | @@ -898,7 +897,7 @@ | |||
1236 | 898 | # Update translation_message's comments and flags. | 897 | # Update translation_message's comments and flags. |
1237 | 899 | if translation_message is not None: | 898 | if translation_message is not None: |
1238 | 900 | translation_message.comment = message.comment | 899 | translation_message.comment = message.comment |
1240 | 901 | if self.translation_import_queue_entry.from_upstream: | 900 | if self.translation_import_queue_entry.by_maintainer: |
1241 | 902 | translation_message.was_obsolete_in_last_import = ( | 901 | translation_message.was_obsolete_in_last_import = ( |
1242 | 903 | message.is_obsolete) | 902 | message.is_obsolete) |
1243 | 904 | 903 |
Here is the db change: