Merge lp:~henninge/launchpad/recife-rename-from-upstream into lp:~launchpad/launchpad/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
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve
Review via email: mp+39980@code.launchpad.net

Commit message

Renamed TranslationImportQueueEntry.from_upstream to TranslationImportQueueEntry.by_maintainer.

Description of the change

Rename TranslationImportQueueEntry.from_upstream to TranslationImportQueueEntry.by_maintainer. It was previously (6 months ago or so) renamed from is_published to from_upstream but the new name fits its purpose best.

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 :

Here is the db change:

=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2010-10-18 16:36:46 +0000
+++ database/sampledata/current-dev.sql 2010-11-03 21:48:03 +0000
@@ -11001,8 +11001,8 @@
1100111001
11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;
1100311003
11004INSERT 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);11004INSERT 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);
11005INSERT 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);11005INSERT 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);
1100611006
1100711007
11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;
1100911009
=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql 2010-10-18 16:36:46 +0000
+++ database/sampledata/current.sql 2010-11-03 21:48:03 +0000
@@ -11001,8 +11001,8 @@
1100111001
11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;
1100311003
11004INSERT 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);11004INSERT 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);
11005INSERT 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);11005INSERT 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);
1100611006
1100711007
11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;
1100911009
=== modified file 'database/schema/patch-2208-99-1.sql'
--- database/schema/patch-2208-99-1.sql 2010-08-24 07:54:39 +0000
+++ database/schema/patch-2208-99-1.sql 2010-11-03 21:48:03 +0000
@@ -4,6 +4,6 @@
4SET client_min_messages=ERROR;4SET client_min_messages=ERROR;
55
6ALTER TABLE TranslationImportQueueEntry6ALTER TABLE TranslationImportQueueEntry
7 RENAME COLUMN is_published TO from_upstream;7 RENAME COLUMN is_published TO by_maintainer;
88
9INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1);9INSERT 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
=== modified file 'database/sampledata/current-dev.sql'
--- database/sampledata/current-dev.sql 2010-11-04 09:32:28 +0000
+++ database/sampledata/current-dev.sql 2010-11-09 12:03:48 +0000
@@ -11001,8 +11001,8 @@
1100111001
11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;
1100311003
11004INSERT 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);11004INSERT 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);
11005INSERT 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);11005INSERT 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);
1100611006
1100711007
11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;
1100911009
=== modified file 'database/sampledata/current.sql'
--- database/sampledata/current.sql 2010-11-04 09:32:28 +0000
+++ database/sampledata/current.sql 2010-11-09 12:03:48 +0000
@@ -11001,8 +11001,8 @@
1100111001
11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;11002ALTER TABLE translationimportqueueentry DISABLE TRIGGER ALL;
1100311003
11004INSERT 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);11004INSERT 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);
11005INSERT 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);11005INSERT 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);
1100611006
1100711007
11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;11008ALTER TABLE translationimportqueueentry ENABLE TRIGGER ALL;
1100911009
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2010-11-04 09:32:28 +0000
+++ database/schema/comments.sql 2010-11-09 12:03:48 +0000
@@ -2036,7 +2036,7 @@
2036COMMENT ON COLUMN TranslationImportQueueEntry.distroseries IS 'The distribution release related to this import.';2036COMMENT ON COLUMN TranslationImportQueueEntry.distroseries IS 'The distribution release related to this import.';
2037COMMENT ON COLUMN TranslationImportQueueEntry.sourcepackagename IS 'The source package name related to this import.';2037COMMENT ON COLUMN TranslationImportQueueEntry.sourcepackagename IS 'The source package name related to this import.';
2038COMMENT ON COLUMN TranslationImportQueueEntry.productseries IS 'The product series related to this import.';2038COMMENT ON COLUMN TranslationImportQueueEntry.productseries IS 'The product series related to this import.';
2039COMMENT ON COLUMN TranslationImportQueueEntry.from_upstream IS 'Notes whether this upload is from an upstream project.';2039COMMENT ON COLUMN TranslationImportQueueEntry.by_maintainer IS 'Notes whether this upload was done by the maintiner of the package or project.';
2040COMMENT ON COLUMN TranslationImportQueueEntry.pofile IS 'Link to the POFile where this import will end.';2040COMMENT ON COLUMN TranslationImportQueueEntry.pofile IS 'Link to the POFile where this import will end.';
2041COMMENT ON COLUMN TranslationImportQueueEntry.potemplate IS 'Link to the POTemplate where this import will end.';2041COMMENT ON COLUMN TranslationImportQueueEntry.potemplate IS 'Link to the POTemplate where this import will end.';
2042COMMENT ON COLUMN TranslationImportQueueEntry.date_status_changed IS 'The date when the status of this entry was changed.';2042COMMENT ON COLUMN TranslationImportQueueEntry.date_status_changed IS 'The date when the status of this entry was changed.';
20432043
=== modified file 'database/schema/patch-2208-99-1.sql'
--- database/schema/patch-2208-99-1.sql 2010-08-24 07:54:39 +0000
+++ database/schema/patch-2208-99-1.sql 2010-11-09 12:03:48 +0000
@@ -4,6 +4,6 @@
4SET client_min_messages=ERROR;4SET client_min_messages=ERROR;
55
6ALTER TABLE TranslationImportQueueEntry6ALTER TABLE TranslationImportQueueEntry
7 RENAME COLUMN is_published TO from_upstream;7 RENAME COLUMN is_published TO by_maintainer;
88
9INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1);9INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 1);
1010
=== modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py'
--- lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-09-06 10:40:54 +0000
+++ lib/lp/soyuz/interfaces/sourcepackagerelease.py 2010-11-09 12:03:48 +0000
@@ -194,13 +194,13 @@
194 argument remains untouched.194 argument remains untouched.
195 """195 """
196196
197 def attachTranslationFiles(tarball_alias, from_upstream, importer=None):197 def attachTranslationFiles(tarball_alias, by_maintainer, importer=None):
198 """Attach a tarball with translations to be imported into Rosetta.198 """Attach a tarball with translations to be imported into Rosetta.
199199
200 :tarball_alias: is a Librarian alias that references to a tarball with200 :tarball_alias: is a Librarian alias that references to a tarball with
201 translations.201 translations.
202 :from_upstream: indicates if the imported files are from an upstream202 :by_maintainer: indicates if the imported files where uploaded by
203 project.203 the maintainer of the project or package.
204 :importer: is the person that did the import.204 :importer: is the person that did the import.
205205
206 raise DownloadFailed if we are not able to fetch the file from206 raise DownloadFailed if we are not able to fetch the file from
207207
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2010-09-06 10:40:54 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2010-11-09 12:03:48 +0000
@@ -592,7 +592,7 @@
592592
593 return change593 return change
594594
595 def attachTranslationFiles(self, tarball_alias, from_upstream,595 def attachTranslationFiles(self, tarball_alias, by_maintainer,
596 importer=None):596 importer=None):
597 """See ISourcePackageRelease."""597 """See ISourcePackageRelease."""
598 tarball = tarball_alias.read()598 tarball = tarball_alias.read()
@@ -603,7 +603,7 @@
603 queue = getUtility(ITranslationImportQueue)603 queue = getUtility(ITranslationImportQueue)
604604
605 queue.addOrUpdateEntriesFromTarball(605 queue.addOrUpdateEntriesFromTarball(
606 tarball, from_upstream, importer,606 tarball, by_maintainer, importer,
607 sourcepackagename=self.sourcepackagename,607 sourcepackagename=self.sourcepackagename,
608 distroseries=self.upload_distroseries,608 distroseries=self.upload_distroseries,
609 filename_filter=_filter_ubuntu_translation_file)609 filename_filter=_filter_ubuntu_translation_file)
610610
=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py 2010-11-09 06:55:07 +0000
+++ lib/lp/testing/factory.py 2010-11-09 12:03:48 +0000
@@ -2610,7 +2610,7 @@
2610 potemplate=None, content=None,2610 potemplate=None, content=None,
2611 uploader=None, pofile=None,2611 uploader=None, pofile=None,
2612 format=None, status=None,2612 format=None, status=None,
2613 from_upstream=False):2613 by_maintainer=False):
2614 """Create a `TranslationImportQueueEntry`."""2614 """Create a `TranslationImportQueueEntry`."""
2615 if path is None:2615 if path is None:
2616 path = self.getUniqueString() + '.pot'2616 path = self.getUniqueString() + '.pot'
@@ -2652,7 +2652,7 @@
2652 path=path, productseries=productseries, distroseries=distroseries,2652 path=path, productseries=productseries, distroseries=distroseries,
2653 sourcepackagename=sourcepackagename, importer=uploader,2653 sourcepackagename=sourcepackagename, importer=uploader,
2654 content=content_reference, status=status, format=format,2654 content=content_reference, status=status, format=format,
2655 from_upstream=from_upstream)2655 by_maintainer=by_maintainer)
26562656
2657 def makeMailingList(self, team, owner):2657 def makeMailingList(self, team, owner):
2658 """Create a mailing list for the team."""2658 """Create a mailing list for the team."""
26592659
=== modified file 'lib/lp/translations/browser/pofile.py'
--- lib/lp/translations/browser/pofile.py 2010-11-08 02:29:37 +0000
+++ lib/lp/translations/browser/pofile.py 2010-11-09 12:03:48 +0000
@@ -700,8 +700,8 @@
700 " recognised as a file that can be imported.")700 " recognised as a file that can be imported.")
701 return701 return
702702
703 # Uploads on this form are never from upstream.703 # Uploads on this form are never done by the maintainer.
704 from_upstream = False704 by_maintainer = False
705705
706 if self.context.path is None:706 if self.context.path is None:
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.
@@ -710,7 +710,7 @@
710 path = self.context.path710 path = self.context.path
711 # Add it to the queue.711 # Add it to the queue.
712 translation_import_queue.addOrUpdateEntry(712 translation_import_queue.addOrUpdateEntry(
713 path, content, from_upstream, self.user,713 path, content, by_maintainer, self.user,
714 sourcepackagename=self.context.potemplate.sourcepackagename,714 sourcepackagename=self.context.potemplate.sourcepackagename,
715 distroseries=self.context.potemplate.distroseries,715 distroseries=self.context.potemplate.distroseries,
716 productseries=self.context.potemplate.productseries,716 productseries=self.context.potemplate.productseries,
717717
=== modified file 'lib/lp/translations/browser/translationimportqueue.py'
--- lib/lp/translations/browser/translationimportqueue.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/browser/translationimportqueue.py 2010-11-09 12:03:48 +0000
@@ -507,10 +507,10 @@
507 self.context.path = path507 self.context.path = path
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.
509 pofile.setPathIfUnique(path)509 pofile.setPathIfUnique(path)
510 elif self.context.from_upstream:510 elif self.context.by_maintainer:
511 # This entry comes from upstream, which means that the path we511 # This entry was uploaded by the maintainer, which means that the
512 # got is exactly the right one. If it's different from what512 # path we got is exactly the right one. If it's different from
513 # pofile has, that would mean that either the entry changed513 # what pofile has, that would mean that either the entry changed
514 # its path since previous upload or that we had to guess it514 # its path since previous upload or that we had to guess it
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.
516 pofile.setPathIfUnique(self.context.path)516 pofile.setPathIfUnique(self.context.path)
517517
=== modified file 'lib/lp/translations/doc/poexport-language-pack.txt'
--- lib/lp/translations/doc/poexport-language-pack.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poexport-language-pack.txt 2010-11-09 12:03:48 +0000
@@ -184,9 +184,9 @@
184184
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')
186 >>> translation_import_queue = getUtility(ITranslationImportQueue)186 >>> translation_import_queue = getUtility(ITranslationImportQueue)
187 >>> from_upstream = True187 >>> by_maintainer = True
188 >>> template_entry = translation_import_queue.addOrUpdateEntry(188 >>> template_entry = translation_import_queue.addOrUpdateEntry(
189 ... firefox_template.path, en_US_xpi.read(), from_upstream,189 ... firefox_template.path, en_US_xpi.read(), by_maintainer,
190 ... mark, distroseries=series, sourcepackagename=spn,190 ... mark, distroseries=series, sourcepackagename=spn,
191 ... potemplate=firefox_template)191 ... potemplate=firefox_template)
192192
@@ -195,7 +195,7 @@
195 >>> es_xpi = get_en_US_xpi_file_to_import('en-US')195 >>> es_xpi = get_en_US_xpi_file_to_import('en-US')
196 >>> firefox_es_translation = firefox_template.newPOFile('es')196 >>> firefox_es_translation = firefox_template.newPOFile('es')
197 >>> translation_entry = translation_import_queue.addOrUpdateEntry(197 >>> translation_entry = translation_import_queue.addOrUpdateEntry(
198 ... 'es.xpi', es_xpi.read(), from_upstream,198 ... 'es.xpi', es_xpi.read(), by_maintainer,
199 ... mark, distroseries=series, sourcepackagename=spn,199 ... mark, distroseries=series, sourcepackagename=spn,
200 ... potemplate=firefox_template,200 ... potemplate=firefox_template,
201 ... pofile=firefox_es_translation)201 ... pofile=firefox_es_translation)
202202
=== modified file 'lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt'
--- lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poimport-pofile-not-exported-from-rosetta.txt 2010-11-09 12:03:48 +0000
@@ -63,7 +63,7 @@
6363
64 >>> pofile = potemplate.newPOFile('cy')64 >>> pofile = potemplate.newPOFile('cy')
6565
66And now, we import a .po file, as not coming from upstream, that lacks the66And now, we import a .po file, not uploaded by the maintainer, that lacks the
67header 'X-Rosetta-Export-Date'. That header is the one that notes that the67header 'X-Rosetta-Export-Date'. That header is the one that notes that the
68file comes from a previous export from Rosetta and when did it happen.68file comes from a previous export from Rosetta and when did it happen.
6969
@@ -77,9 +77,9 @@
77 ... msgid "foo"77 ... msgid "foo"
78 ... msgstr "blah"78 ... msgstr "blah"
79 ... '''79 ... '''
80 >>> from_upstream = False80 >>> by_maintainer = False
81 >>> entry = translation_import_queue.addOrUpdateEntry(81 >>> entry = translation_import_queue.addOrUpdateEntry(
82 ... pofile.path, pofile_contents, from_upstream, person,82 ... pofile.path, pofile_contents, by_maintainer, person,
83 ... productseries=series, potemplate=potemplate, pofile=pofile)83 ... productseries=series, potemplate=potemplate, pofile=pofile)
84 >>> transaction.commit()84 >>> transaction.commit()
8585
@@ -147,9 +147,9 @@
147147
148Now, attach the file again, but this time as coming from upstream.148Now, attach the file again, but this time as coming from upstream.
149149
150 >>> from_upstream = True150 >>> by_maintainer = True
151 >>> entry = translation_import_queue.addOrUpdateEntry(151 >>> entry = translation_import_queue.addOrUpdateEntry(
152 ... pofile.path, pofile_contents, from_upstream, person,152 ... pofile.path, pofile_contents, by_maintainer, person,
153 ... productseries=series, potemplate=potemplate, pofile=pofile)153 ... productseries=series, potemplate=potemplate, pofile=pofile)
154 >>> transaction.commit()154 >>> transaction.commit()
155155
156156
=== modified file 'lib/lp/translations/doc/poimport-pofile-old-po-imported.txt'
--- lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poimport-pofile-old-po-imported.txt 2010-11-09 12:03:48 +0000
@@ -76,9 +76,9 @@
76 ... msgid "foo"76 ... msgid "foo"
77 ... msgstr "blah"77 ... msgstr "blah"
78 ... ''' % datetime.datetime.now(UTC).isoformat()78 ... ''' % datetime.datetime.now(UTC).isoformat()
79 >>> from_upstream = False79 >>> by_maintainer = False
80 >>> entry = translation_import_queue.addOrUpdateEntry(80 >>> entry = translation_import_queue.addOrUpdateEntry(
81 ... pofile.path, pofile_contents, from_upstream, person,81 ... pofile.path, pofile_contents, by_maintainer, person,
82 ... productseries=series, potemplate=potemplate, pofile=pofile)82 ... productseries=series, potemplate=potemplate, pofile=pofile)
83 >>> transaction.commit()83 >>> transaction.commit()
8484
@@ -124,9 +124,9 @@
124 ... msgid "foo"124 ... msgid "foo"
125 ... msgstr "blah"125 ... msgstr "blah"
126 ... ''' % datetime.datetime.now(UTC).isoformat()126 ... ''' % datetime.datetime.now(UTC).isoformat()
127 >>> from_upstream = False127 >>> by_maintainer = False
128 >>> entry = translation_import_queue.addOrUpdateEntry(128 >>> entry = translation_import_queue.addOrUpdateEntry(
129 ... pofile.path, pofile_contents, from_upstream, person,129 ... pofile.path, pofile_contents, by_maintainer, person,
130 ... productseries=series, potemplate=potemplate, pofile=pofile)130 ... productseries=series, potemplate=potemplate, pofile=pofile)
131 >>> transaction.commit()131 >>> transaction.commit()
132132
@@ -185,11 +185,11 @@
185 <BLANKLINE>185 <BLANKLINE>
186186
187Finally we are going to import the same po file with the old187Finally we are going to import the same po file with the old
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.
189189
190 >>> from_upstream = True190 >>> by_maintainer = True
191 >>> entry = translation_import_queue.addOrUpdateEntry(191 >>> entry = translation_import_queue.addOrUpdateEntry(
192 ... pofile.path, pofile_contents, from_upstream, person,192 ... pofile.path, pofile_contents, by_maintainer, person,
193 ... productseries=series, potemplate=potemplate, pofile=pofile)193 ... productseries=series, potemplate=potemplate, pofile=pofile)
194 >>> transaction.commit()194 >>> transaction.commit()
195195
196196
=== modified file 'lib/lp/translations/doc/poimport-pofile-syntax-error.txt'
--- lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poimport-pofile-syntax-error.txt 2010-11-09 12:03:48 +0000
@@ -72,9 +72,9 @@
72 ... msgid "foo"72 ... msgid "foo"
73 ... msgstr blah"73 ... msgstr blah"
74 ... ''' % datetime.datetime.now(UTC).isoformat()74 ... ''' % datetime.datetime.now(UTC).isoformat()
75 >>> from_upstream = False75 >>> by_maintainer = False
76 >>> entry = translation_import_queue.addOrUpdateEntry(76 >>> entry = translation_import_queue.addOrUpdateEntry(
77 ... pofile.path, pofile_contents, from_upstream, person,77 ... pofile.path, pofile_contents, by_maintainer, person,
78 ... productseries=series, potemplate=potemplate, pofile=pofile)78 ... productseries=series, potemplate=potemplate, pofile=pofile)
79 >>> transaction.commit()79 >>> transaction.commit()
8080
@@ -137,9 +137,9 @@
137 ... msgid "\xa9 Yoyodine Industries"137 ... msgid "\xa9 Yoyodine Industries"
138 ... msgstr ""138 ... msgstr ""
139 ... '''.encode('utf-8')139 ... '''.encode('utf-8')
140 >>> from_upstream = False140 >>> by_maintainer = False
141 >>> entry = translation_import_queue.addOrUpdateEntry(141 >>> entry = translation_import_queue.addOrUpdateEntry(
142 ... pofile.path, pofile_contents, from_upstream, person,142 ... pofile.path, pofile_contents, by_maintainer, person,
143 ... productseries=series, potemplate=potemplate, pofile=pofile)143 ... productseries=series, potemplate=potemplate, pofile=pofile)
144 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)144 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
145 >>> transaction.commit()145 >>> transaction.commit()
146146
=== modified file 'lib/lp/translations/doc/poimport-potemplate-syntax-error.txt'
--- lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poimport-potemplate-syntax-error.txt 2010-11-09 12:03:48 +0000
@@ -57,9 +57,9 @@
57 ... msgid "foo"57 ... msgid "foo"
58 ... msgstr ""58 ... msgstr ""
59 ... '''59 ... '''
60 >>> from_upstream = True60 >>> by_maintainer = True
61 >>> entry = translation_import_queue.addOrUpdateEntry(61 >>> entry = translation_import_queue.addOrUpdateEntry(
62 ... potemplate.path, potemplate_contents, from_upstream, person,62 ... potemplate.path, potemplate_contents, by_maintainer, person,
63 ... productseries=series, potemplate=potemplate)63 ... productseries=series, potemplate=potemplate)
64 >>> transaction.commit()64 >>> transaction.commit()
65 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)65 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -119,9 +119,9 @@
119 ... msgid "\xa9 Yoyodine Industries"119 ... msgid "\xa9 Yoyodine Industries"
120 ... msgstr ""120 ... msgstr ""
121 ... '''.encode('utf-8')121 ... '''.encode('utf-8')
122 >>> from_upstream = False122 >>> by_maintainer = False
123 >>> entry = translation_import_queue.addOrUpdateEntry(123 >>> entry = translation_import_queue.addOrUpdateEntry(
124 ... potemplate.path, potemplate_contents, from_upstream, person,124 ... potemplate.path, potemplate_contents, by_maintainer, person,
125 ... productseries=series, potemplate=potemplate)125 ... productseries=series, potemplate=potemplate)
126 >>> transaction.commit()126 >>> transaction.commit()
127 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)127 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
128128
=== modified file 'lib/lp/translations/doc/poimport.txt'
--- lib/lp/translations/doc/poimport.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/poimport.txt 2010-11-09 12:03:48 +0000
@@ -703,7 +703,7 @@
703Upstream import notifications703Upstream import notifications
704-----------------------------704-----------------------------
705705
706Add an upstream POFile import (i.e. from a package or bzr branch),706Add a maintainer POFile import (i.e. from a package or bzr branch),
707approve and import it.707approve and import it.
708708
709 >>> pofile_contents = r'''709 >>> pofile_contents = r'''
@@ -719,9 +719,9 @@
719 ... msgstr "blah"719 ... msgstr "blah"
720 ... '''720 ... '''
721 >>> pofile = factory.makePOFile('sr', potemplate=potemplate)721 >>> pofile = factory.makePOFile('sr', potemplate=potemplate)
722 >>> from_upstream = True722 >>> by_maintainer = True
723 >>> entry = translation_import_queue.addOrUpdateEntry(723 >>> entry = translation_import_queue.addOrUpdateEntry(
724 ... pofile.path, pofile_contents, from_upstream, person,724 ... pofile.path, pofile_contents, by_maintainer, person,
725 ... distroseries=distroseries, sourcepackagename=sourcepackagename,725 ... distroseries=distroseries, sourcepackagename=sourcepackagename,
726 ... potemplate=potemplate, pofile=pofile)726 ... potemplate=potemplate, pofile=pofile)
727 >>> transaction.commit()727 >>> transaction.commit()
@@ -742,7 +742,7 @@
742742
743 >>> pofile_contents = pofile_contents[:-2]743 >>> pofile_contents = pofile_contents[:-2]
744 >>> entry = translation_import_queue.addOrUpdateEntry(744 >>> entry = translation_import_queue.addOrUpdateEntry(
745 ... pofile.path, pofile_contents, from_upstream, person,745 ... pofile.path, pofile_contents, by_maintainer, person,
746 ... distroseries=distroseries, sourcepackagename=sourcepackagename,746 ... distroseries=distroseries, sourcepackagename=sourcepackagename,
747 ... potemplate=potemplate, pofile=pofile)747 ... potemplate=potemplate, pofile=pofile)
748 >>> transaction.commit()748 >>> transaction.commit()
749749
=== modified file 'lib/lp/translations/doc/rosetta-karma.txt'
--- lib/lp/translations/doc/rosetta-karma.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/rosetta-karma.txt 2010-11-09 12:03:48 +0000
@@ -52,9 +52,9 @@
52automatic imports from Ubuntu. In this case, we shouldn't give any kind52automatic imports from Ubuntu. In this case, we shouldn't give any kind
53of karma to that user.53of karma to that user.
5454
55 >>> comes_from_upstream = True55 >>> uploaded_by_maintainer = True
56 >>> entry = translation_import_queue.addOrUpdateEntry(56 >>> entry = translation_import_queue.addOrUpdateEntry(
57 ... potemplate.path, potemplate_contents, comes_from_upstream,57 ... potemplate.path, potemplate_contents, uploaded_by_maintainer,
58 ... rosetta_experts, productseries=potemplate.productseries,58 ... rosetta_experts, productseries=potemplate.productseries,
59 ... potemplate=potemplate)59 ... potemplate=potemplate)
6060
@@ -89,7 +89,7 @@
8989
90 >>> potemplate = POTemplate.get(1)90 >>> potemplate = POTemplate.get(1)
91 >>> entry = translation_import_queue.addOrUpdateEntry(91 >>> entry = translation_import_queue.addOrUpdateEntry(
92 ... potemplate.path, potemplate_contents, comes_from_upstream,92 ... potemplate.path, potemplate_contents, uploaded_by_maintainer,
93 ... foo_bar, productseries=potemplate.productseries,93 ... foo_bar, productseries=potemplate.productseries,
94 ... potemplate=potemplate)94 ... potemplate=potemplate)
95 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)95 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -145,7 +145,7 @@
145Do the import.145Do the import.
146146
147 >>> entry = translation_import_queue.addOrUpdateEntry(147 >>> entry = translation_import_queue.addOrUpdateEntry(
148 ... pofile.path, pofile_contents, comes_from_upstream,148 ... pofile.path, pofile_contents, uploaded_by_maintainer,
149 ... rosetta_experts, productseries=potemplate.productseries,149 ... rosetta_experts, productseries=potemplate.productseries,
150 ... potemplate=potemplate, pofile=pofile)150 ... potemplate=potemplate, pofile=pofile)
151 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)151 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -172,7 +172,7 @@
172 >>> potemplate = POTemplate.get(1)172 >>> potemplate = POTemplate.get(1)
173 >>> pofile = potemplate.getPOFileByLang('es')173 >>> pofile = potemplate.getPOFileByLang('es')
174 >>> entry = translation_import_queue.addOrUpdateEntry(174 >>> entry = translation_import_queue.addOrUpdateEntry(
175 ... pofile.path, pofile_contents, comes_from_upstream, foo_bar,175 ... pofile.path, pofile_contents, uploaded_by_maintainer, foo_bar,
176 ... productseries=potemplate.productseries, potemplate=potemplate,176 ... productseries=potemplate.productseries, potemplate=potemplate,
177 ... pofile=pofile)177 ... pofile=pofile)
178 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)178 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -209,7 +209,7 @@
209 >>> potemplate = POTemplate.get(1)209 >>> potemplate = POTemplate.get(1)
210 >>> pofile = potemplate.getPOFileByLang('es')210 >>> pofile = potemplate.getPOFileByLang('es')
211 >>> entry = translation_import_queue.addOrUpdateEntry(211 >>> entry = translation_import_queue.addOrUpdateEntry(
212 ... pofile.path, pofile_contents, not comes_from_upstream, foo_bar,212 ... pofile.path, pofile_contents, not uploaded_by_maintainer, foo_bar,
213 ... productseries=potemplate.productseries, potemplate=potemplate,213 ... productseries=potemplate.productseries, potemplate=potemplate,
214 ... pofile=pofile)214 ... pofile=pofile)
215 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)215 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -241,7 +241,7 @@
241 >>> potemplate = POTemplate.get(1)241 >>> potemplate = POTemplate.get(1)
242 >>> pofile = potemplate.getPOFileByLang('es')242 >>> pofile = potemplate.getPOFileByLang('es')
243 >>> entry = translation_import_queue.addOrUpdateEntry(243 >>> entry = translation_import_queue.addOrUpdateEntry(
244 ... pofile.path, pofile_contents, not comes_from_upstream, foo_bar,244 ... pofile.path, pofile_contents, not uploaded_by_maintainer, foo_bar,
245 ... productseries=potemplate.productseries, potemplate=potemplate,245 ... productseries=potemplate.productseries, potemplate=potemplate,
246 ... pofile=pofile)246 ... pofile=pofile)
247 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)247 >>> entry.setStatus(RosettaImportStatus.APPROVED, rosetta_experts)
@@ -294,13 +294,13 @@
294 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')294 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')
295 >>> new_translations = {0: 'bar'}295 >>> new_translations = {0: 'bar'}
296 >>> fuzzy = False296 >>> fuzzy = False
297 >>> from_upstream = False297 >>> by_maintainer = False
298298
299And we can see as he won't get any karma activity from that, otherwise it'd be299And we can see as he won't get any karma activity from that, otherwise it'd be
300printed after the call to updateTranslationSet().300printed after the call to updateTranslationSet().
301301
302 >>> translationmessage = potmsgset.updateTranslation(302 >>> translationmessage = potmsgset.updateTranslation(
303 ... pofile, no_priv, new_translations, from_upstream,303 ... pofile, no_priv, new_translations, by_maintainer,
304 ... lock_timestamp=datetime.datetime.now(UTC))304 ... lock_timestamp=datetime.datetime.now(UTC))
305 >>> flush_database_caches()305 >>> flush_database_caches()
306306
@@ -315,7 +315,7 @@
315 >>> pofile = potemplate.getPOFileByLang('es')315 >>> pofile = potemplate.getPOFileByLang('es')
316 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')316 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')
317 >>> translationmessage = potmsgset.updateTranslation(317 >>> translationmessage = potmsgset.updateTranslation(
318 ... pofile, no_priv, new_translations, from_upstream,318 ... pofile, no_priv, new_translations, by_maintainer,
319 ... lock_timestamp=datetime.datetime.now(UTC))319 ... lock_timestamp=datetime.datetime.now(UTC))
320 Karma added: action=translationsuggestionadded, product=evolution320 Karma added: action=translationsuggestionadded, product=evolution
321 >>> transaction.commit()321 >>> transaction.commit()
@@ -334,7 +334,7 @@
334 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')334 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')
335 >>> new_translations = {0: u'somethingelse'}335 >>> new_translations = {0: u'somethingelse'}
336 >>> translationmessage = potmsgset.updateTranslation(336 >>> translationmessage = potmsgset.updateTranslation(
337 ... pofile, kurem, new_translations, from_upstream,337 ... pofile, kurem, new_translations, by_maintainer,
338 ... lock_timestamp=datetime.datetime.now(UTC))338 ... lock_timestamp=datetime.datetime.now(UTC))
339 Karma added: action=translationsuggestionapproved, product=evolution339 Karma added: action=translationsuggestionapproved, product=evolution
340 Karma added: action=translationreview, product=evolution340 Karma added: action=translationreview, product=evolution
@@ -349,7 +349,7 @@
349 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')349 >>> potmsgset = potemplate.getPOTMsgSetByMsgIDText(u'foo')
350 >>> new_translations = {0: u'changed again'}350 >>> new_translations = {0: u'changed again'}
351 >>> translationmessage = potmsgset.updateTranslation(351 >>> translationmessage = potmsgset.updateTranslation(
352 ... pofile, kurem, new_translations, from_upstream,352 ... pofile, kurem, new_translations, by_maintainer,
353 ... lock_timestamp=datetime.datetime.now(UTC))353 ... lock_timestamp=datetime.datetime.now(UTC))
354 Karma added: action=translationsuggestionapproved, product=evolution354 Karma added: action=translationsuggestionapproved, product=evolution
355 >>> transaction.commit()355 >>> transaction.commit()
356356
=== modified file 'lib/lp/translations/doc/translationimportqueue.txt'
--- lib/lp/translations/doc/translationimportqueue.txt 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/doc/translationimportqueue.txt 2010-11-09 12:03:48 +0000
@@ -156,11 +156,11 @@
156 >>> transaction.commit()156 >>> transaction.commit()
157 >>> previous_date_status_changed = entry.date_status_changed157 >>> previous_date_status_changed = entry.date_status_changed
158158
159Do the new upload. It will be an upstream upload.159Do the new upload. It will be an upload by the maintainer.
160160
161 >>> from_upstream = True161 >>> by_maintainer = True
162 >>> po_sr_entry = translationimportqueue.addOrUpdateEntry(162 >>> po_sr_entry = translationimportqueue.addOrUpdateEntry(
163 ... u'po/sr.po', 'foo', from_upstream, rosetta_experts,163 ... u'po/sr.po', 'foo', by_maintainer, rosetta_experts,
164 ... distroseries=hoary_distroseries,164 ... distroseries=hoary_distroseries,
165 ... sourcepackagename=evolution_sourcepackagename)165 ... sourcepackagename=evolution_sourcepackagename)
166166
@@ -223,11 +223,11 @@
223 >>> guessed_pofile == pofile223 >>> guessed_pofile == pofile
224 True224 True
225225
226And because it's an upstream upload, the IPOFile in our database got226And because it's an upload by the maintainer, the IPOFile in our database got
227its path changed to the one noted by this upload instead of having the227its path changed to the one noted by this upload instead of having the
228one we set a couple of lines ago (u'po/sr-old.pot'):228one we set a couple of lines ago (u'po/sr-old.pot'):
229229
230 >>> po_sr_entry.from_upstream230 >>> po_sr_entry.by_maintainer
231 True231 True
232 >>> pofile.path == po_sr_entry.path232 >>> pofile.path == po_sr_entry.path
233 True233 True
@@ -1122,7 +1122,7 @@
1122 ... }1122 ... }
1123 >>> tarfile_content = LaunchpadWriteTarFile.files_to_string(1123 >>> tarfile_content = LaunchpadWriteTarFile.files_to_string(
1124 ... test_tar_content)1124 ... test_tar_content)
1125 >>> from_upstream = True1125 >>> by_maintainer = True
11261126
1127We will need this helper function to print the queue content.1127We will need this helper function to print the queue content.
11281128
@@ -1155,7 +1155,7 @@
1155product. There will be three new entries from the tarball.1155product. There will be three new entries from the tarball.
11561156
1157 >>> translationimportqueue.addOrUpdateEntriesFromTarball(1157 >>> translationimportqueue.addOrUpdateEntriesFromTarball(
1158 ... tarfile_content, from_upstream, rosetta_experts,1158 ... tarfile_content, by_maintainer, rosetta_experts,
1159 ... productseries=evolution_productseries,1159 ... productseries=evolution_productseries,
1160 ... potemplate=evolution_22_test_template)1160 ... potemplate=evolution_22_test_template)
1161 (3, [])1161 (3, [])
@@ -1190,7 +1190,7 @@
1190 Foo template1190 Foo template
11911191
1192 >>> entry = translationimportqueue.addOrUpdateEntry(1192 >>> entry = translationimportqueue.addOrUpdateEntry(
1193 ... "foo.pot", "New content", from_upstream, rosetta_experts,1193 ... "foo.pot", "New content", by_maintainer, rosetta_experts,
1194 ... productseries=evolution_productseries,1194 ... productseries=evolution_productseries,
1195 ... potemplate=evolution_22_test_template)1195 ... potemplate=evolution_22_test_template)
1196 >>> entry = removeSecurityProxy(entry)1196 >>> entry = removeSecurityProxy(entry)
@@ -1204,7 +1204,7 @@
1204on a best match basis. The entry is updated.1204on a best match basis. The entry is updated.
12051205
1206 >>> entry = translationimportqueue.addOrUpdateEntry(1206 >>> entry = translationimportqueue.addOrUpdateEntry(
1207 ... "foo.pot", "Even newer content", from_upstream, rosetta_experts,1207 ... "foo.pot", "Even newer content", by_maintainer, rosetta_experts,
1208 ... productseries=evolution_productseries)1208 ... productseries=evolution_productseries)
1209 >>> entry = removeSecurityProxy(entry)1209 >>> entry = removeSecurityProxy(entry)
1210 >>> transaction.commit()1210 >>> transaction.commit()
@@ -1221,7 +1221,7 @@
1221 Spanish translation1221 Spanish translation
12221222
1223 >>> entry = removeSecurityProxy(translationimportqueue.addOrUpdateEntry(1223 >>> entry = removeSecurityProxy(translationimportqueue.addOrUpdateEntry(
1224 ... "es.po", "New po content", from_upstream, rosetta_experts,1224 ... "es.po", "New po content", by_maintainer, rosetta_experts,
1225 ... productseries=evolution_productseries))1225 ... productseries=evolution_productseries))
1226 >>> transaction.commit()1226 >>> transaction.commit()
1227 >>> entry is existing_entry1227 >>> entry is existing_entry
@@ -1233,7 +1233,7 @@
1233we get again three more entries.1233we get again three more entries.
12341234
1235 >>> translationimportqueue.addOrUpdateEntriesFromTarball(1235 >>> translationimportqueue.addOrUpdateEntriesFromTarball(
1236 ... tarfile_content, from_upstream, rosetta_experts,1236 ... tarfile_content, by_maintainer, rosetta_experts,
1237 ... productseries=evolution_productseries,1237 ... productseries=evolution_productseries,
1238 ... potemplate=evolution_22_template)1238 ... potemplate=evolution_22_template)
1239 (3, [])1239 (3, [])
@@ -1256,7 +1256,7 @@
1256updated.1256updated.
12571257
1258 >>> print queue.addOrUpdateEntry(1258 >>> print queue.addOrUpdateEntry(
1259 ... "foo.pot", "Latest content", from_upstream, rosetta_experts,1259 ... "foo.pot", "Latest content", by_maintainer, rosetta_experts,
1260 ... productseries=evolution_productseries)1260 ... productseries=evolution_productseries)
1261 None1261 None
12621262
@@ -1264,11 +1264,11 @@
1264then to a specific template.1264then to a specific template.
12651265
1266 >>> existing_entry = queue.addOrUpdateEntry(1266 >>> existing_entry = queue.addOrUpdateEntry(
1267 ... "bar.pot", "Bar content", from_upstream, rosetta_experts,1267 ... "bar.pot", "Bar content", by_maintainer, rosetta_experts,
1268 ... productseries=evolution_productseries)1268 ... productseries=evolution_productseries)
1269 >>> existing_entry = removeSecurityProxy(existing_entry)1269 >>> existing_entry = removeSecurityProxy(existing_entry)
1270 >>> entry = queue.addOrUpdateEntry(1270 >>> entry = queue.addOrUpdateEntry(
1271 ... "bar.pot", "Bar content", from_upstream, rosetta_experts,1271 ... "bar.pot", "Bar content", by_maintainer, rosetta_experts,
1272 ... productseries=evolution_productseries,1272 ... productseries=evolution_productseries,
1273 ... potemplate=evolution_22_template)1273 ... potemplate=evolution_22_template)
12741274
@@ -1284,7 +1284,7 @@
1284When uploading to the prouct now, the best matching entry is updated.1284When uploading to the prouct now, the best matching entry is updated.
12851285
1286 >>> entry = queue.addOrUpdateEntry(1286 >>> entry = queue.addOrUpdateEntry(
1287 ... "bar.pot", "New bar content", from_upstream, rosetta_experts,1287 ... "bar.pot", "New bar content", by_maintainer, rosetta_experts,
1288 ... productseries=evolution_productseries)1288 ... productseries=evolution_productseries)
1289 >>> entry = removeSecurityProxy(entry)1289 >>> entry = removeSecurityProxy(entry)
1290 >>> transaction.commit()1290 >>> transaction.commit()
@@ -1321,7 +1321,7 @@
1321filter, so there seem to be only 2 files in the tarball.1321filter, so there seem to be only 2 files in the tarball.
13221322
1323 >>> translationimportqueue.addOrUpdateEntriesFromTarball(1323 >>> translationimportqueue.addOrUpdateEntriesFromTarball(
1324 ... tarfile_content, from_upstream, rosetta_experts,1324 ... tarfile_content, by_maintainer, rosetta_experts,
1325 ... productseries=netapplet_trunk,1325 ... productseries=netapplet_trunk,
1326 ... filename_filter=swizzle_filename)1326 ... filename_filter=swizzle_filename)
1327 (2, [])1327 (2, [])
13281328
=== modified file 'lib/lp/translations/interfaces/translationimportqueue.py'
--- lib/lp/translations/interfaces/translationimportqueue.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/interfaces/translationimportqueue.py 2010-11-09 12:03:48 +0000
@@ -175,8 +175,10 @@
175 required=False,175 required=False,
176 vocabulary="SourcePackageName")176 vocabulary="SourcePackageName")
177177
178 from_upstream = Bool(178 by_maintainer = Bool(
179 title=_("This import comes from an upstream project."),179 title=_(
180 "This upload was done by the maintainer "
181 "of the project or package."),
180 description=_(182 description=_(
181 "If checked, the translations in this import will be marked "183 "If checked, the translations in this import will be marked "
182 "as is_current_upstream."),184 "as is_current_upstream."),
@@ -309,15 +311,15 @@
309 def countEntries():311 def countEntries():
310 """Return the number of `TranslationImportQueueEntry` records."""312 """Return the number of `TranslationImportQueueEntry` records."""
311313
312 def addOrUpdateEntry(path, content, from_upstream, importer,314 def addOrUpdateEntry(path, content, by_maintainer, importer,
313 sourcepackagename=None, distroseries=None, productseries=None,315 sourcepackagename=None, distroseries=None, productseries=None,
314 potemplate=None, pofile=None, format=None):316 potemplate=None, pofile=None, format=None):
315 """Return a new or updated entry of the import queue.317 """Return a new or updated entry of the import queue.
316318
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.
318 :arg content: is the file content.320 :arg content: is the file content.
319 :arg from_upstream: indicates if the imported file is coming from an321 :arg by_maintainer: indicates if the file was uploaded by the
320 upstream project.322 maintainer of the project or package.
321 :arg importer: is the person that did the import.323 :arg importer: is the person that did the import.
322 :arg sourcepackagename: is the link of this import with source324 :arg sourcepackagename: is the link of this import with source
323 package.325 package.
@@ -332,14 +334,14 @@
332 only one of them can be specified.334 only one of them can be specified.
333 """335 """
334336
335 def addOrUpdateEntriesFromTarball(content, from_upstream, importer,337 def addOrUpdateEntriesFromTarball(content, by_maintainer, importer,
336 sourcepackagename=None, distroseries=None, productseries=None,338 sourcepackagename=None, distroseries=None, productseries=None,
337 potemplate=None, filename_filter=None, approver_factory=None):339 potemplate=None, filename_filter=None, approver_factory=None):
338 """Add all .po or .pot files from the tarball at :content:.340 """Add all .po or .pot files from the tarball at :content:.
339341
340 :arg content: is a tarball stream.342 :arg content: is a tarball stream.
341 :arg from_upstream: indicates if the imported file is coming from an343 :arg by_maintainer: indicates if the file was uploaded by the
342 upstream project.344 maintainer of the project or package.
343 :arg importer: is the person that did the import.345 :arg importer: is the person that did the import.
344 :arg sourcepackagename: is the link of this import with source346 :arg sourcepackagename: is the link of this import with source
345 package.347 package.
346348
=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py 2010-11-09 06:55:07 +0000
+++ lib/lp/translations/model/pofile.py 2010-11-09 12:03:48 +0000
@@ -1185,10 +1185,10 @@
1185 entry_to_import.setStatus(1185 entry_to_import.setStatus(
1186 RosettaImportStatus.FAILED, rosetta_experts)1186 RosettaImportStatus.FAILED, rosetta_experts)
1187 else:1187 else:
1188 if (entry_to_import.from_upstream and1188 if (entry_to_import.by_maintainer and
1189 not needs_notification_for_imported):1189 not needs_notification_for_imported):
1190 # If it's an upstream upload (i.e. from a package or bzr1190 # If it's an upload by the maintainer of the project or
1191 # branch), do not send success notifications unless they1191 # package, do not send success notifications unless they
1192 # are needed.1192 # are needed.
1193 subject = None1193 subject = None
11941194
@@ -1196,8 +1196,8 @@
1196 RosettaImportStatus.IMPORTED, rosetta_experts)1196 RosettaImportStatus.IMPORTED, rosetta_experts)
1197 # Assign karma to the importer if this is not an automatic import1197 # Assign karma to the importer if this is not an automatic import
1198 # (all automatic imports come from the rosetta expert user) and1198 # (all automatic imports come from the rosetta expert user) and
1199 # comes from upstream.1199 # was done by the maintainer.
1200 if (entry_to_import.from_upstream and1200 if (entry_to_import.by_maintainer and
1201 entry_to_import.importer.id != rosetta_experts.id):1201 entry_to_import.importer.id != rosetta_experts.id):
1202 entry_to_import.importer.assignKarma(1202 entry_to_import.importer.assignKarma(
1203 'translationimportupstream',1203 'translationimportupstream',
12041204
=== modified file 'lib/lp/translations/model/translationimportqueue.py'
--- lib/lp/translations/model/translationimportqueue.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/model/translationimportqueue.py 2010-11-09 12:03:48 +0000
@@ -156,7 +156,7 @@
156 distroseries = Reference(distroseries_id, 'DistroSeries.id')156 distroseries = Reference(distroseries_id, 'DistroSeries.id')
157 productseries_id = Int(name='productseries', allow_none=True)157 productseries_id = Int(name='productseries', allow_none=True)
158 productseries = Reference(productseries_id, 'ProductSeries.id')158 productseries = Reference(productseries_id, 'ProductSeries.id')
159 from_upstream = BoolCol(notNull=True)159 by_maintainer = BoolCol(notNull=True)
160 pofile = ForeignKey(foreignKey='POFile', dbName='pofile',160 pofile = ForeignKey(foreignKey='POFile', dbName='pofile',
161 notNull=False, default=None)161 notNull=False, default=None)
162 potemplate = ForeignKey(foreignKey='POTemplate',162 potemplate = ForeignKey(foreignKey='POTemplate',
@@ -485,12 +485,12 @@
485 if pofile.canEditTranslations(self.importer):485 if pofile.canEditTranslations(self.importer):
486 pofile.owner = self.importer486 pofile.owner = self.importer
487487
488 if self.from_upstream:488 if self.by_maintainer:
489 # This entry comes from upstream, which means that the path we got489 # This was uploaded by the maintainer, which means that the path
490 # is exactly the right one. If it's different from what pofile490 # we got is exactly the right one. If it's different from what
491 # has, that would mean that either the entry changed its path491 # pofile has, that would mean that either the entry changed its
492 # since previous upload or that we had to guess it and now that we492 # path since previous upload or that we had to guess it and now
493 # got the right path, we should fix it.493 # that we got the right path, we should fix it.
494 pofile.setPathIfUnique(self.path)494 pofile.setPathIfUnique(self.path)
495495
496 if (sourcepackagename is None and496 if (sourcepackagename is None and
@@ -912,7 +912,7 @@
912 return (912 return (
913 format, translation_importer.getTranslationFormatImporter(format))913 format, translation_importer.getTranslationFormatImporter(format))
914914
915 def addOrUpdateEntry(self, path, content, from_upstream, importer,915 def addOrUpdateEntry(self, path, content, by_maintainer, importer,
916 sourcepackagename=None, distroseries=None,916 sourcepackagename=None, distroseries=None,
917 productseries=None, potemplate=None, pofile=None,917 productseries=None, potemplate=None, pofile=None,
918 format=None):918 format=None):
@@ -948,13 +948,13 @@
948 entry = TranslationImportQueueEntry(path=path, content=alias,948 entry = TranslationImportQueueEntry(path=path, content=alias,
949 importer=importer, sourcepackagename=sourcepackagename,949 importer=importer, sourcepackagename=sourcepackagename,
950 distroseries=distroseries, productseries=productseries,950 distroseries=distroseries, productseries=productseries,
951 from_upstream=from_upstream, potemplate=potemplate,951 by_maintainer=by_maintainer, potemplate=potemplate,
952 pofile=pofile, format=format)952 pofile=pofile, format=format)
953 else:953 else:
954 # It's an update.954 # It's an update.
955 entry.setErrorOutput(None)955 entry.setErrorOutput(None)
956 entry.content = alias956 entry.content = alias
957 entry.from_upstream = from_upstream957 entry.by_maintainer = by_maintainer
958 if potemplate is not None:958 if potemplate is not None:
959 # Only set the linked IPOTemplate object if it's not None.959 # Only set the linked IPOTemplate object if it's not None.
960 entry.potemplate = potemplate960 entry.potemplate = potemplate
@@ -1015,7 +1015,7 @@
10151015
1016 return True1016 return True
10171017
1018 def addOrUpdateEntriesFromTarball(self, content, from_upstream, importer,1018 def addOrUpdateEntriesFromTarball(self, content, by_maintainer, importer,
1019 sourcepackagename=None, distroseries=None, productseries=None,1019 sourcepackagename=None, distroseries=None, productseries=None,
1020 potemplate=None, filename_filter=None, approver_factory=None):1020 potemplate=None, filename_filter=None, approver_factory=None):
1021 """See ITranslationImportQueue."""1021 """See ITranslationImportQueue."""
@@ -1056,7 +1056,7 @@
10561056
1057 path = upload_files[tarinfo.name]1057 path = upload_files[tarinfo.name]
1058 entry = approver.approve(self.addOrUpdateEntry(1058 entry = approver.approve(self.addOrUpdateEntry(
1059 path, file_content, from_upstream, importer,1059 path, file_content, by_maintainer, importer,
1060 sourcepackagename=sourcepackagename,1060 sourcepackagename=sourcepackagename,
1061 distroseries=distroseries, productseries=productseries,1061 distroseries=distroseries, productseries=productseries,
1062 potemplate=potemplate))1062 potemplate=potemplate))
10631063
=== modified file 'lib/lp/translations/utilities/gettext_po_importer.py'
--- lib/lp/translations/utilities/gettext_po_importer.py 2010-08-23 08:35:29 +0000
+++ lib/lp/translations/utilities/gettext_po_importer.py 2010-11-09 12:03:48 +0000
@@ -32,7 +32,7 @@
32 self.productseries = None32 self.productseries = None
33 self.distroseries = None33 self.distroseries = None
34 self.sourcepackagename = None34 self.sourcepackagename = None
35 self.from_upstream = False35 self.by_maintainer = False
36 self.content = None36 self.content = None
3737
38 def getFormat(self, file_contents):38 def getFormat(self, file_contents):
@@ -55,7 +55,7 @@
55 self.distroseries = translation_import_queue_entry.distroseries55 self.distroseries = translation_import_queue_entry.distroseries
56 self.sourcepackagename = (56 self.sourcepackagename = (
57 translation_import_queue_entry.sourcepackagename)57 translation_import_queue_entry.sourcepackagename)
58 self.from_upstream = translation_import_queue_entry.from_upstream58 self.by_maintainer = translation_import_queue_entry.by_maintainer
5959
60 librarian_client = getUtility(ILibrarianClient)60 librarian_client = getUtility(ILibrarianClient)
61 self.content = librarian_client.getFileByAlias(61 self.content = librarian_client.getFileByAlias(
6262
=== modified file 'lib/lp/translations/utilities/mozilla_xpi_importer.py'
--- lib/lp/translations/utilities/mozilla_xpi_importer.py 2010-08-23 08:35:29 +0000
+++ lib/lp/translations/utilities/mozilla_xpi_importer.py 2010-11-09 12:03:48 +0000
@@ -380,7 +380,7 @@
380 self.productseries = None380 self.productseries = None
381 self.distroseries = None381 self.distroseries = None
382 self.sourcepackagename = None382 self.sourcepackagename = None
383 self.from_upstream = False383 self.by_maintainer = False
384 self._translation_file = None384 self._translation_file = None
385385
386 def getFormat(self, file_contents):386 def getFormat(self, file_contents):
@@ -406,7 +406,7 @@
406 self.distroseries = translation_import_queue_entry.distroseries406 self.distroseries = translation_import_queue_entry.distroseries
407 self.sourcepackagename = (407 self.sourcepackagename = (
408 translation_import_queue_entry.sourcepackagename)408 translation_import_queue_entry.sourcepackagename)
409 self.from_upstream = translation_import_queue_entry.from_upstream409 self.by_maintainer = translation_import_queue_entry.by_maintainer
410410
411 librarian_client = getUtility(ILibrarianClient)411 librarian_client = getUtility(ILibrarianClient)
412 content = librarian_client.getFileByAlias(412 content = librarian_client.getFileByAlias(
413413
=== modified file 'lib/lp/translations/utilities/tests/helpers.py'
--- lib/lp/translations/utilities/tests/helpers.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/utilities/tests/helpers.py 2010-11-09 12:03:48 +0000
@@ -26,7 +26,7 @@
2626
2727
28def import_pofile_or_potemplate(file_contents, person,28def import_pofile_or_potemplate(file_contents, person,
29 pofile=None, potemplate=None, from_upstream=True):29 pofile=None, potemplate=None, by_maintainer=True):
30 """Import a `POFile` or `POTemplate` from the given string.30 """Import a `POFile` or `POTemplate` from the given string.
3131
32 :param file_contents: text of "file" to import.32 :param file_contents: text of "file" to import.
@@ -34,24 +34,26 @@
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.
35 :param potemplate: if uploading a `POTemplate`, file to import to; None35 :param potemplate: if uploading a `POTemplate`, file to import to; None
36 otherwise.36 otherwise.
37 :param by_maintainer: true if this file was uplaoded by the maintainer
38 of the project or package.
37 :return: `TranslationImportQueueEntry` as added to the import queue.39 :return: `TranslationImportQueueEntry` as added to the import queue.
38 """40 """
39 translation_import_queue = getUtility(ITranslationImportQueue)41 translation_import_queue = getUtility(ITranslationImportQueue)
40 if pofile is not None:42 if pofile is not None:
41 if pofile.potemplate.distroseries is None:43 if pofile.potemplate.distroseries is None:
42 entry = translation_import_queue.addOrUpdateEntry(44 entry = translation_import_queue.addOrUpdateEntry(
43 pofile.path, file_contents, from_upstream, person,45 pofile.path, file_contents, by_maintainer, person,
44 productseries=pofile.potemplate.productseries, pofile=pofile)46 productseries=pofile.potemplate.productseries, pofile=pofile)
45 else:47 else:
46 entry = translation_import_queue.addOrUpdateEntry(48 entry = translation_import_queue.addOrUpdateEntry(
47 pofile.path, file_contents, from_upstream, person,49 pofile.path, file_contents, by_maintainer, person,
48 distroseries=pofile.potemplate.distroseries,50 distroseries=pofile.potemplate.distroseries,
49 sourcepackagename=pofile.potemplate.sourcepackagename,51 sourcepackagename=pofile.potemplate.sourcepackagename,
50 pofile=pofile)52 pofile=pofile)
51 target = pofile53 target = pofile
52 else:54 else:
53 # A POTemplate can only be 'upstream', so setting the55 # A POTemplate can only be uploaded by the maintainer, so setting the
54 # from_upstream flag makes no difference.56 # by_maintainer flag makes no difference.
55 if potemplate.distroseries is None:57 if potemplate.distroseries is None:
56 entry = translation_import_queue.addOrUpdateEntry(58 entry = translation_import_queue.addOrUpdateEntry(
57 potemplate.path, file_contents, True, person,59 potemplate.path, file_contents, True, person,
5860
=== modified file 'lib/lp/translations/utilities/tests/import-flags.txt'
--- lib/lp/translations/utilities/tests/import-flags.txt 2010-03-24 14:25:52 +0000
+++ lib/lp/translations/utilities/tests/import-flags.txt 2010-11-09 12:03:48 +0000
@@ -223,7 +223,7 @@
223223
224 >>> entry = import_pofile_or_potemplate(test_translation_update1,224 >>> entry = import_pofile_or_potemplate(test_translation_update1,
225 ... carlos, pofile=firefox_serbian,225 ... carlos, pofile=firefox_serbian,
226 ... from_upstream=False)226 ... by_maintainer=False)
227 >>> print entry.status.name227 >>> print entry.status.name
228 IMPORTED228 IMPORTED
229 >>> flush_database_caches()229 >>> flush_database_caches()
@@ -289,7 +289,7 @@
289289
290 >>> entry = import_pofile_or_potemplate(test_translation_imported_update,290 >>> entry = import_pofile_or_potemplate(test_translation_imported_update,
291 ... carlos, pofile=firefox_serbian,291 ... carlos, pofile=firefox_serbian,
292 ... from_upstream=True)292 ... by_maintainer=True)
293 >>> print entry.status.name293 >>> print entry.status.name
294 IMPORTED294 IMPORTED
295 >>> flush_database_caches()295 >>> flush_database_caches()
@@ -361,7 +361,7 @@
361361
362 >>> entry = import_pofile_or_potemplate(test_translation_update2,362 >>> entry = import_pofile_or_potemplate(test_translation_update2,
363 ... carlos, pofile=firefox_serbian,363 ... carlos, pofile=firefox_serbian,
364 ... from_upstream=False)364 ... by_maintainer=False)
365 >>> print entry.status.name365 >>> print entry.status.name
366 IMPORTED366 IMPORTED
367 >>> flush_database_caches()367 >>> flush_database_caches()
@@ -430,7 +430,7 @@
430430
431 >>> entry = import_pofile_or_potemplate(test_translation_update3,431 >>> entry = import_pofile_or_potemplate(test_translation_update3,
432 ... carlos, pofile=firefox_serbian,432 ... carlos, pofile=firefox_serbian,
433 ... from_upstream=False)433 ... by_maintainer=False)
434 >>> print entry.status.name434 >>> print entry.status.name
435 IMPORTED435 IMPORTED
436436
@@ -501,7 +501,7 @@
501501
502 >>> entry = import_pofile_or_potemplate(test_translation_update3,502 >>> entry = import_pofile_or_potemplate(test_translation_update3,
503 ... carlos, pofile=firefox_serbian,503 ... carlos, pofile=firefox_serbian,
504 ... from_upstream=False)504 ... by_maintainer=False)
505 >>> print entry.status.name505 >>> print entry.status.name
506 IMPORTED506 IMPORTED
507507
@@ -528,7 +528,7 @@
528528
529 >>> entry = import_pofile_or_potemplate(test_translation_update3,529 >>> entry = import_pofile_or_potemplate(test_translation_update3,
530 ... carlos, pofile=firefox_serbian,530 ... carlos, pofile=firefox_serbian,
531 ... from_upstream=True)531 ... by_maintainer=True)
532 >>> print entry.status.name532 >>> print entry.status.name
533 IMPORTED533 IMPORTED
534534
535535
=== modified file 'lib/lp/translations/utilities/tests/test_file_importer.py'
--- lib/lp/translations/utilities/tests/test_file_importer.py 2010-11-09 06:55:07 +0000
+++ lib/lp/translations/utilities/tests/test_file_importer.py 2010-11-09 12:03:48 +0000
@@ -116,29 +116,29 @@
116 """Class test for translation importer component"""116 """Class test for translation importer component"""
117 layer = ZopelessDatabaseLayer117 layer = ZopelessDatabaseLayer
118118
119 def _createFileImporters(self, pot_content, po_content, from_upstream):119 def _createFileImporters(self, pot_content, po_content, by_maintainer):
120 """Create queue entries from POT and PO content strings.120 """Create queue entries from POT and PO content strings.
121 Create importers from the entries."""121 Create importers from the entries."""
122 pot_importer = self._createPOTFileImporter(122 pot_importer = self._createPOTFileImporter(
123 pot_content, from_upstream)123 pot_content, by_maintainer)
124 po_importer = self._createPOFileImporter(124 po_importer = self._createPOFileImporter(
125 pot_importer, po_content, from_upstream)125 pot_importer, po_content, by_maintainer)
126 return (pot_importer, po_importer)126 return (pot_importer, po_importer)
127127
128 def _createPOTFileImporter(self, pot_content, from_upstream):128 def _createPOTFileImporter(self, pot_content, by_maintainer):
129 """Create queue entries from POT content string.129 """Create queue entries from POT content string.
130 Create an importer from the entry."""130 Create an importer from the entry."""
131 potemplate = self.factory.makePOTemplate()131 potemplate = self.factory.makePOTemplate()
132 template_entry = self.translation_import_queue.addOrUpdateEntry(132 template_entry = self.translation_import_queue.addOrUpdateEntry(
133 potemplate.path, pot_content,133 potemplate.path, pot_content,
134 from_upstream, self.importer_person,134 by_maintainer, self.importer_person,
135 productseries=potemplate.productseries,135 productseries=potemplate.productseries,
136 potemplate=potemplate)136 potemplate=potemplate)
137 self.fake_librarian.pretendCommit()137 self.fake_librarian.pretendCommit()
138 return POTFileImporter(template_entry, GettextPOImporter(), None)138 return POTFileImporter(template_entry, GettextPOImporter(), None)
139139
140 def _createPOFileImporter(self,140 def _createPOFileImporter(self,
141 pot_importer, po_content, from_upstream, existing_pofile=None,141 pot_importer, po_content, by_maintainer, existing_pofile=None,
142 person=None):142 person=None):
143 """Create a PO entry from content, relating to a template_entry.143 """Create a PO entry from content, relating to a template_entry.
144 Create an importer for the entry."""144 Create an importer for the entry."""
@@ -150,7 +150,7 @@
150 pofile = existing_pofile150 pofile = existing_pofile
151 person = person or self.importer_person151 person = person or self.importer_person
152 translation_entry = self.translation_import_queue.addOrUpdateEntry(152 translation_entry = self.translation_import_queue.addOrUpdateEntry(
153 pofile.path, po_content, from_upstream, person,153 pofile.path, po_content, by_maintainer, person,
154 productseries=potemplate.productseries, pofile=pofile)154 productseries=potemplate.productseries, pofile=pofile)
155 self.fake_librarian.pretendCommit()155 self.fake_librarian.pretendCommit()
156 return POFileImporter(translation_entry, GettextPOImporter(), None)156 return POFileImporter(translation_entry, GettextPOImporter(), None)
@@ -232,14 +232,14 @@
232 "FileImporter.getOrCreatePOTMessageSet did not get an existing "232 "FileImporter.getOrCreatePOTMessageSet did not get an existing "
233 "IPOTMsgSet object from the database.")233 "IPOTMsgSet object from the database.")
234234
235 def _test_storeTranslationsInDatabase_empty(self, from_upstream=True):235 def _test_storeTranslationsInDatabase_empty(self, by_maintainer=True):
236 """Check whether we store empty messages appropriately."""236 """Check whether we store empty messages appropriately."""
237 # Construct a POFile importer.237 # Construct a POFile importer.
238 pot_importer = self._createPOTFileImporter(238 pot_importer = self._createPOTFileImporter(
239 TEST_TEMPLATE_EXPORTED, from_upstream=True)239 TEST_TEMPLATE_EXPORTED, by_maintainer=True)
240 importer = self._createPOFileImporter(240 importer = self._createPOFileImporter(
241 pot_importer, TEST_TRANSLATION_EXPORTED,241 pot_importer, TEST_TRANSLATION_EXPORTED,
242 from_upstream=from_upstream, person=self.importer_person)242 by_maintainer=by_maintainer, person=self.importer_person)
243243
244 # Empty message to import.244 # Empty message to import.
245 message = TranslationMessageData()245 message = TranslationMessageData()
@@ -253,12 +253,12 @@
253 self.assertIs(None, translation)253 self.assertIs(None, translation)
254254
255 def test_storeTranslationsInDatabase_empty_imported(self):255 def test_storeTranslationsInDatabase_empty_imported(self):
256 """Storing empty messages for published imports appropriately."""256 """Storing empty messages for maintainer uploads appropriately."""
257 self._test_storeTranslationsInDatabase_empty(from_upstream=True)257 self._test_storeTranslationsInDatabase_empty(by_maintainer=True)
258258
259 def test_storeTranslationsInDatabase_empty_user(self):259 def test_storeTranslationsInDatabase_empty_user(self):
260 """Store empty messages for user uploads appropriately."""260 """Store empty messages for user uploads appropriately."""
261 self._test_storeTranslationsInDatabase_empty(from_upstream=False)261 self._test_storeTranslationsInDatabase_empty(by_maintainer=False)
262262
263 def test_FileImporter_storeTranslationsInDatabase_privileges(self):263 def test_FileImporter_storeTranslationsInDatabase_privileges(self):
264 """Test `storeTranslationsInDatabase` privileges."""264 """Test `storeTranslationsInDatabase` privileges."""
@@ -292,7 +292,7 @@
292 context=message.context))292 context=message.context))
293293
294 po_importer = self._createPOFileImporter(294 po_importer = self._createPOFileImporter(
295 pot_importer, TEST_TRANSLATION_EXPORTED, from_upstream=True,295 pot_importer, TEST_TRANSLATION_EXPORTED, by_maintainer=True,
296 person=unprivileged_person)296 person=unprivileged_person)
297297
298 entry = removeSecurityProxy(298 entry = removeSecurityProxy(
@@ -543,7 +543,7 @@
543 self.translation_import_queue = getUtility(ITranslationImportQueue)543 self.translation_import_queue = getUtility(ITranslationImportQueue)
544 self.importer_person = self.factory.makePerson()544 self.importer_person = self.factory.makePerson()
545545
546 def _make_queue_entry(self, from_upstream):546 def _make_queue_entry(self, by_maintainer):
547 pofile = self.factory.makePOFile('eo')547 pofile = self.factory.makePOFile('eo')
548 # Create a header with a newer date than what is found in548 # Create a header with a newer date than what is found in
549 # TEST_TRANSLATION_FILE.549 # TEST_TRANSLATION_FILE.
@@ -551,7 +551,7 @@
551 "Content-Type: text/plain; charset=UTF-8\n")551 "Content-Type: text/plain; charset=UTF-8\n")
552 po_content = TEST_TRANSLATION_FILE % ("", "foo", "bar")552 po_content = TEST_TRANSLATION_FILE % ("", "foo", "bar")
553 queue_entry = self.translation_import_queue.addOrUpdateEntry(553 queue_entry = self.translation_import_queue.addOrUpdateEntry(
554 pofile.path, po_content, from_upstream, self.importer_person,554 pofile.path, po_content, by_maintainer, self.importer_person,
555 productseries=pofile.potemplate.productseries, pofile=pofile)555 productseries=pofile.potemplate.productseries, pofile=pofile)
556 self.fake_librarian.pretendCommit()556 self.fake_librarian.pretendCommit()
557 return queue_entry557 return queue_entry
@@ -609,7 +609,7 @@
609 self.upstream_template = self.factory.makePOTemplate(609 self.upstream_template = self.factory.makePOTemplate(
610 productseries=self.upstream_productseries)610 productseries=self.upstream_productseries)
611611
612 def _makeImportEntry(self, side, from_upstream=False, uploader=None,612 def _makeImportEntry(self, side, by_maintainer=False, uploader=None,
613 no_upstream=False):613 no_upstream=False):
614 if side == self.UPSTREAM:614 if side == self.UPSTREAM:
615 potemplate = self.upstream_template615 potemplate = self.upstream_template
@@ -636,7 +636,7 @@
636 pofile = self.factory.makePOFile(636 pofile = self.factory.makePOFile(
637 self.language.code, potemplate=potemplate, create_sharing=True)637 self.language.code, potemplate=potemplate, create_sharing=True)
638 entry = self.factory.makeTranslationImportQueueEntry(638 entry = self.factory.makeTranslationImportQueueEntry(
639 potemplate=potemplate, from_upstream=from_upstream,639 potemplate=potemplate, by_maintainer=by_maintainer,
640 uploader=uploader, content=self.POFILE)640 uploader=uploader, content=self.POFILE)
641 entry.potemplate = potemplate641 entry.potemplate = potemplate
642 entry.pofile = pofile642 entry.pofile = pofile
@@ -694,7 +694,7 @@
694 def test_share_with_other_side_ubuntu_from_package(self):694 def test_share_with_other_side_ubuntu_from_package(self):
695 # An ubuntu queue entry that is imported from an upstream package695 # An ubuntu queue entry that is imported from an upstream package
696 # will be shared with upstream.696 # will be shared with upstream.
697 entry = self._makeImportEntry(self.UBUNTU, from_upstream=True)697 entry = self._makeImportEntry(self.UBUNTU, by_maintainer=True)
698 importer = POFileImporter(698 importer = POFileImporter(
699 entry, importers[TranslationFileFormat.PO], None)699 entry, importers[TranslationFileFormat.PO], None)
700 self.assertTrue(700 self.assertTrue(
701701
=== modified file 'lib/lp/translations/utilities/tests/test_gettext_po_importer.py'
--- lib/lp/translations/utilities/tests/test_gettext_po_importer.py 2010-10-18 16:36:46 +0000
+++ lib/lp/translations/utilities/tests/test_gettext_po_importer.py 2010-11-09 12:03:48 +0000
@@ -57,20 +57,20 @@
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.
58 self.translation_import_queue = getUtility(ITranslationImportQueue)58 self.translation_import_queue = getUtility(ITranslationImportQueue)
59 template_path = 'po/testing.pot'59 template_path = 'po/testing.pot'
60 from_upstream = True60 by_maintainer = True
61 personset = getUtility(IPersonSet)61 personset = getUtility(IPersonSet)
62 importer = personset.getByName('carlos')62 importer = personset.getByName('carlos')
63 productset = getUtility(IProductSet)63 productset = getUtility(IProductSet)
64 firefox = productset.getByName('firefox')64 firefox = productset.getByName('firefox')
65 productseries = firefox.getSeries('trunk')65 productseries = firefox.getSeries('trunk')
66 template_entry = self.translation_import_queue.addOrUpdateEntry(66 template_entry = self.translation_import_queue.addOrUpdateEntry(
67 template_path, test_template, from_upstream, importer,67 template_path, test_template, by_maintainer, importer,
68 productseries=productseries)68 productseries=productseries)
6969
70 # Add another one, a translation file.70 # Add another one, a translation file.
71 pofile_path = 'po/es.po'71 pofile_path = 'po/es.po'
72 translation_entry = self.translation_import_queue.addOrUpdateEntry(72 translation_entry = self.translation_import_queue.addOrUpdateEntry(
73 pofile_path, test_translation_file, from_upstream, importer,73 pofile_path, test_translation_file, by_maintainer, importer,
74 productseries=productseries)74 productseries=productseries)
7575
76 transaction.commit()76 transaction.commit()
7777
=== modified file 'lib/lp/translations/utilities/tests/test_kde_po_importer.py'
--- lib/lp/translations/utilities/tests/test_kde_po_importer.py 2010-10-18 16:36:46 +0000
+++ lib/lp/translations/utilities/tests/test_kde_po_importer.py 2010-11-09 12:03:48 +0000
@@ -71,20 +71,20 @@
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.
72 self.translation_import_queue = getUtility(ITranslationImportQueue)72 self.translation_import_queue = getUtility(ITranslationImportQueue)
73 template_path = 'po/testing.pot'73 template_path = 'po/testing.pot'
74 from_upstream = True74 by_maintainer = True
75 personset = getUtility(IPersonSet)75 personset = getUtility(IPersonSet)
76 importer = personset.getByName('carlos')76 importer = personset.getByName('carlos')
77 productset = getUtility(IProductSet)77 productset = getUtility(IProductSet)
78 firefox = productset.getByName('firefox')78 firefox = productset.getByName('firefox')
79 firefox_trunk = firefox.getSeries('trunk')79 firefox_trunk = firefox.getSeries('trunk')
80 template_entry = self.translation_import_queue.addOrUpdateEntry(80 template_entry = self.translation_import_queue.addOrUpdateEntry(
81 template_path, test_kde_template, from_upstream, importer,81 template_path, test_kde_template, by_maintainer, importer,
82 productseries=firefox_trunk)82 productseries=firefox_trunk)
8383
84 # Add another one, a translation file.84 # Add another one, a translation file.
85 pofile_path = 'po/sr.po'85 pofile_path = 'po/sr.po'
86 translation_entry = self.translation_import_queue.addOrUpdateEntry(86 translation_entry = self.translation_import_queue.addOrUpdateEntry(
87 pofile_path, test_kde_translation_file, from_upstream, importer,87 pofile_path, test_kde_translation_file, by_maintainer, importer,
88 productseries=firefox_trunk)88 productseries=firefox_trunk)
8989
90 # Add a non-KDE PO file which gets recognized as regular PO file90 # Add a non-KDE PO file which gets recognized as regular PO file
@@ -93,7 +93,7 @@
93 firefox_10 = firefox.getSeries('1.0')93 firefox_10 = firefox.getSeries('1.0')
94 gettext_template_entry = (94 gettext_template_entry = (
95 self.translation_import_queue.addOrUpdateEntry(95 self.translation_import_queue.addOrUpdateEntry(
96 template_path, test_template, from_upstream, importer,96 template_path, test_template, by_maintainer, importer,
97 productseries=firefox_10))97 productseries=firefox_10))
9898
99 transaction.commit()99 transaction.commit()
100100
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_import.py'
--- lib/lp/translations/utilities/tests/test_xpi_import.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_import.py 2010-11-09 12:03:48 +0000
@@ -77,7 +77,7 @@
77 file_contents=es_xpi.read(),77 file_contents=es_xpi.read(),
78 person=self.importer,78 person=self.importer,
79 pofile=self.spanish_firefox,79 pofile=self.spanish_firefox,
80 from_upstream=True)80 by_maintainer=True)
8181
82 def _assertXpiMessageInvariant(self, message):82 def _assertXpiMessageInvariant(self, message):
83 """Check whether invariant part of all messages are correct."""83 """Check whether invariant part of all messages are correct."""
8484
=== modified file 'lib/lp/translations/utilities/tests/test_xpi_po_exporter.py'
--- lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/utilities/tests/test_xpi_po_exporter.py 2010-11-09 12:03:48 +0000
@@ -81,9 +81,9 @@
8181
82 # Attach it to the import queue.82 # Attach it to the import queue.
83 translation_import_queue = getUtility(ITranslationImportQueue)83 translation_import_queue = getUtility(ITranslationImportQueue)
84 from_upstream = True84 by_maintainer = True
85 entry = translation_import_queue.addOrUpdateEntry(85 entry = translation_import_queue.addOrUpdateEntry(
86 self.firefox_template.path, en_US_xpi.read(), from_upstream,86 self.firefox_template.path, en_US_xpi.read(), by_maintainer,
87 self.importer, productseries=self.firefox_template.productseries,87 self.importer, productseries=self.firefox_template.productseries,
88 potemplate=self.firefox_template)88 potemplate=self.firefox_template)
8989
9090
=== modified file 'lib/lp/translations/utilities/translation_import.py'
--- lib/lp/translations/utilities/translation_import.py 2010-11-05 08:11:53 +0000
+++ lib/lp/translations/utilities/translation_import.py 2010-11-09 12:03:48 +0000
@@ -466,8 +466,8 @@
466 ITranslationSideTraitsSet).getForTemplate(self.potemplate)466 ITranslationSideTraitsSet).getForTemplate(self.potemplate)
467 if traits.side == TranslationSide.UPSTREAM:467 if traits.side == TranslationSide.UPSTREAM:
468 return True468 return True
469 # Check from_upstream.469 # Maintainer uploads are always shared with Ubuntu.
470 if self.translation_import_queue_entry.from_upstream:470 if self.translation_import_queue_entry.by_maintainer:
471 return True471 return True
472 # Find the sharing POFile and check permissions.472 # Find the sharing POFile and check permissions.
473 productseries = self.potemplate.distroseries.getSourcePackage(473 productseries = self.potemplate.distroseries.getSourcePackage(
@@ -498,8 +498,8 @@
498 self.pofile.language.code == 'en')498 self.pofile.language.code == 'en')
499499
500 def _storeCredits(self, potmsgset, credits):500 def _storeCredits(self, potmsgset, credits):
501 """Store credits but only from upstream."""501 """Store credits but only those provided by the maintainer."""
502 if not self.translation_import_queue_entry.from_upstream:502 if not self.translation_import_queue_entry.by_maintainer:
503 return None503 return None
504 return potmsgset.setCurrentTranslation(504 return potmsgset.setCurrentTranslation(
505 self.pofile, self.last_translator, credits,505 self.pofile, self.last_translator, credits,
@@ -585,7 +585,7 @@
585 if validation_ok and self.is_editor:585 if validation_ok and self.is_editor:
586 return self._approveMessage(potmsgset, new_message, message_data)586 return self._approveMessage(potmsgset, new_message, message_data)
587587
588 if self.translation_import_queue_entry.from_upstream:588 if self.translation_import_queue_entry.by_maintainer:
589 # XXX: henninge 2010-09-21: Mixed models!589 # XXX: henninge 2010-09-21: Mixed models!
590 # This is mimicking the old behavior to still mark these messages590 # This is mimicking the old behavior to still mark these messages
591 # as "imported". Will have to be removed when591 # as "imported". Will have to be removed when
@@ -754,7 +754,7 @@
754 # Update translation_message's comments and flags.754 # Update translation_message's comments and flags.
755 if translation_message is not None:755 if translation_message is not None:
756 translation_message.comment = message.comment756 translation_message.comment = message.comment
757 if self.translation_import_queue_entry.from_upstream:757 if self.translation_import_queue_entry.by_maintainer:
758 translation_message.was_obsolete_in_last_import = (758 translation_message.was_obsolete_in_last_import = (
759 message.is_obsolete)759 message.is_obsolete)
760760
@@ -779,10 +779,10 @@
779 if upload_header is not None:779 if upload_header is not None:
780 # Check whether we are importing a new version.780 # Check whether we are importing a new version.
781 if self.pofile.isTranslationRevisionDateOlder(upload_header):781 if self.pofile.isTranslationRevisionDateOlder(upload_header):
782 if translation_import_queue_entry.from_upstream:782 if translation_import_queue_entry.by_maintainer:
783 # Upstream files can be older than the last import783 # Files uploaded by the maintainer can be older than the
784 # and still be imported. They don't update header784 # last import and still be imported. They don't update
785 # information, though, so this is deleted here.785 # header information, though, so this is deleted here.
786 self.translation_file.header = None786 self.translation_file.header = None
787 else:787 else:
788 # The new imported file is older than latest one imported,788 # The new imported file is older than latest one imported,
@@ -802,10 +802,10 @@
802 self.lock_timestamp = (802 self.lock_timestamp = (
803 upload_header.launchpad_export_date)803 upload_header.launchpad_export_date)
804804
805 if (not self.translation_import_queue_entry.from_upstream and805 if (not self.translation_import_queue_entry.by_maintainer and
806 self.lock_timestamp is None):806 self.lock_timestamp is None):
807 # We got a translation file from offline translation (not from807 # We got a translation file from offline translation (not from
808 # upstream) and it misses the export time so we don't have a808 # the maintainer) and it misses the export time so we don't have a
809 # way to figure whether someone changed the same translations809 # way to figure whether someone changed the same translations
810 # while the offline work was done.810 # while the offline work was done.
811 raise NotExportedFromLaunchpad811 raise NotExportedFromLaunchpad
@@ -824,11 +824,10 @@
824 self.last_translator = (824 self.last_translator = (
825 self.translation_import_queue_entry.importer)825 self.translation_import_queue_entry.importer)
826826
827 if self.translation_import_queue_entry.from_upstream:827 if self.translation_import_queue_entry.by_maintainer:
828 # An unprivileged user wouldn't have been able to upload an828 # The maintainer always has edit rights.
829 # upstream file in the first place. But for Soyuz uploads,829 # For Soyuz uploads, the "importer" reflects the package upload
830 # the "importer" reflects the package upload, not the830 # not the translations upload.
831 # translations upload. So don't check for editing rights.
832 self.is_editor = True831 self.is_editor = True
833 else:832 else:
834 # Use the importer rights to make sure the imported833 # Use the importer rights to make sure the imported
@@ -838,9 +837,9 @@
838 self.pofile.canEditTranslations(837 self.pofile.canEditTranslations(
839 self.translation_import_queue_entry.importer))838 self.translation_import_queue_entry.importer))
840839
841 from_upstream = self.translation_import_queue_entry.from_upstream840 by_maintainer = self.translation_import_queue_entry.by_maintainer
842 self.pofile_in_db = ExistingPOFileInDatabase(841 self.pofile_in_db = ExistingPOFileInDatabase(
843 self.pofile, is_current_upstream=from_upstream)842 self.pofile, is_current_upstream=by_maintainer)
844843
845 def _getPersonByEmail(self, email, name=None):844 def _getPersonByEmail(self, email, name=None):
846 """Return the person for given email.845 """Return the person for given email.
@@ -874,7 +873,7 @@
874 """See FileImporter."""873 """See FileImporter."""
875 # Mark this message as seen in the import874 # Mark this message as seen in the import
876 self.pofile_in_db.markMessageAsSeen(message)875 self.pofile_in_db.markMessageAsSeen(message)
877 if self.translation_import_queue_entry.from_upstream:876 if self.translation_import_queue_entry.by_maintainer:
878 if self.pofile_in_db.isAlreadyTranslatedTheSameUpstream(message):877 if self.pofile_in_db.isAlreadyTranslatedTheSameUpstream(message):
879 return878 return
880 else:879 else:
@@ -898,7 +897,7 @@
898 # Update translation_message's comments and flags.897 # Update translation_message's comments and flags.
899 if translation_message is not None:898 if translation_message is not None:
900 translation_message.comment = message.comment899 translation_message.comment = message.comment
901 if self.translation_import_queue_entry.from_upstream:900 if self.translation_import_queue_entry.by_maintainer:
902 translation_message.was_obsolete_in_last_import = (901 translation_message.was_obsolete_in_last_import = (
903 message.is_obsolete)902 message.is_obsolete)
904903

Subscribers

People subscribed via source and target branches