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

Here is the db change: