Re: [Launchpad-reviewers] [Merge] ~pappacena/launchpad:snap-pillar-db-indexes into launchpad:db-devel
Review: Approve db -- https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/398361 Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:snap-pillar-db. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
Re: [Launchpad-reviewers] [Merge] ~pappacena/launchpad:snap-pillar-db into launchpad:db-devel
Review: Approve db -- https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/397459 Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:snap-pillar-db. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-services-messages-doctests-future-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-services-messages-doctests-future-imports into launchpad:master. Commit message: Convert lp.services.messages doctests to __future__ imports Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398551 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-services-messages-doctests-future-imports into launchpad:master. diff --git a/lib/lp/services/messages/doc/message.txt b/lib/lp/services/messages/doc/message.txt index 0ae44d0..d77836a 100644 --- a/lib/lp/services/messages/doc/message.txt +++ b/lib/lp/services/messages/doc/message.txt @@ -52,7 +52,7 @@ may be accessed using the chunks attribute, or simply by iterating over the Message. >>> for chunk in msg: -... print pretty([chunk.sequence, chunk.content, chunk.blob]) +... print(pretty([chunk.sequence, chunk.content, chunk.blob])) [1, 'The Content', None] >>> msg.chunks[0].message == msg True @@ -129,7 +129,7 @@ normal. >>> chunks = msg.chunks >>> for chunk in chunks: ... if chunk.content: -... print '%2d - %s' % (chunk.sequence, pretty(chunk.content)) +... print('%2d - %s' % (chunk.sequence, pretty(chunk.content))) 1 - 'Plain text' 3 - 'Unicode\u2122 text' @@ -151,7 +151,7 @@ containing a signature.asc attachment. >>> from lp.services.mail.tests.helpers import read_test_message >>> signed_msg = read_test_message('signed_detached.txt') >>> signed_msg['Message-Id'] = '' ->>> print signed_msg.as_string() +>>> print(signed_msg.as_string()) Date... ... Content-Type: multipart/signed; micalg=pgp-sha1; @@ -167,7 +167,7 @@ containing a signature.asc attachment. ... >>> signed_message = msg_set.fromEmail(message_as_bytes(signed_msg)) ->>> print signed_message.text_contents +>>> print(signed_message.text_contents) Some signed content. Note that the second and forth chunks of the previous message were not @@ -253,10 +253,10 @@ used as a default. >>> msg = msgset.fromEmail(raw_msg) >>> for chunk in msg.chunks: ... if chunk.content is not None: -... print '%d - %s' % (chunk.sequence, pretty(chunk.content)) +... print('%d - %s' % (chunk.sequence, pretty(chunk.content))) ... else: -... print '%d - file: %s (%s)' % ( -... chunk.sequence, chunk.blob.filename, chunk.blob.mimetype) +... print('%d - file: %s (%s)' % ( +... chunk.sequence, chunk.blob.filename, chunk.blob.mimetype)) 1 - 'Plain text' 2 - 'Plain text without a ch\xc4\x83\xc5\x95\xc5\x9d\xc4\x9b\xc5\xa3.' 3 - file: attachment.txt (text/plain; charset="us-ascii") @@ -289,7 +289,7 @@ the message, like it is done when forwarding an email. >>> forwarded_msg = read_test_message('forwarded-msg.txt') >>> msg = msgset.fromEmail(message_as_bytes(forwarded_msg)) ->>> print msg.text_contents +>>> print(msg.text_contents) Forwarding test message. @@ -517,7 +517,7 @@ Finally, let's test the goldilocks message, where the date is just right: ... ... Moo ... ''') ->>> print msg.datecreated +>>> print(msg.datecreated) 2005-06-17 09:45:13+00:00 @@ -534,7 +534,7 @@ which often works. >>> msg_path = os.path.join(os.path.dirname(__file__), mail_path) >>> with open(msg_path, 'rb') as f: ... raw_msg = f.read() ->>> print raw_msg +>>> print(raw_msg) MIME-Version: 1.0 ... Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed... diff --git a/lib/lp/services/messages/tests/test_doc.py b/lib/lp/services/messages/tests/test_doc.py index 4ed6e1e..8f61d74 100644 --- a/lib/lp/services/messages/tests/test_doc.py +++ b/lib/lp/services/messages/tests/test_doc.py @@ -9,11 +9,14 @@ import os from lp.services.testing import build_test_suite from lp.testing.layers import LaunchpadFunctionalLayer +from lp.testing.systemdocs import setUp here = os.path.dirname(os.path.realpath(__file__)) def test_suite(): -suite = build_test_suite(here, {}, layer=LaunchpadFunctionalLayer) +suite = build_test_suite( +here, {}, layer=LaunchpadFunctionalLayer, +setUp=lambda test: setUp(test, future=True)) return suite ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-changes-changelog-copyright-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-changes-changelog-copyright-bytes into launchpad:master. Commit message: Read changes/changelog/copyright files in binary mode Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398549 The data read from these is used as the input to functions that expect bytes. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-changes-changelog-copyright-bytes into launchpad:master. diff --git a/lib/lp/archiveuploader/nascentupload.py b/lib/lp/archiveuploader/nascentupload.py index 6602200..be9cdcc 100644 --- a/lib/lp/archiveuploader/nascentupload.py +++ b/lib/lp/archiveuploader/nascentupload.py @@ -715,12 +715,11 @@ class NascentUpload: # very small, and at some point the script infrastructure will # only send emails when the script exits successfully. if notify: -changes_file_object = open(self.changes.filepath, "r") -self.queue_root.notify( -summary_text=self.warning_message, -changes_file_object=changes_file_object, -logger=self.logger) -changes_file_object.close() +with open(self.changes.filepath, "rb") as changes_file_object: +self.queue_root.notify( +summary_text=self.warning_message, +changes_file_object=changes_file_object, +logger=self.logger) return True except QueueInconsistentStateError as e: @@ -762,7 +761,7 @@ class NascentUpload: if not self.queue_root: self.queue_root = self._createQueueEntry() -with open(self.changes.filepath, "r") as changes_file_object: +with open(self.changes.filepath, "rb") as changes_file_object: self.queue_root.notify( status=PackageUploadStatus.REJECTED, summary_text=self.rejection_message, diff --git a/lib/lp/archiveuploader/tests/__init__.py b/lib/lp/archiveuploader/tests/__init__.py index ff5da4d..e5abd8d 100644 --- a/lib/lp/archiveuploader/tests/__init__.py +++ b/lib/lp/archiveuploader/tests/__init__.py @@ -49,7 +49,7 @@ def insertFakeChangesFile(fileID, path=None): """ if path is None: path = datadir("ed-0.2-21/ed_0.2-21_source.changes") -with open(path, 'r') as changes_file_obj: +with open(path, 'rb') as changes_file_obj: test_changes_file = changes_file_obj.read() fillLibrarianFile(fileID, content=test_changes_file) diff --git a/lib/lp/archiveuploader/tests/test_sync_notification.py b/lib/lp/archiveuploader/tests/test_sync_notification.py index 45d6704..4eb00f0 100644 --- a/lib/lp/archiveuploader/tests/test_sync_notification.py +++ b/lib/lp/archiveuploader/tests/test_sync_notification.py @@ -54,7 +54,8 @@ class FakeChangesFile: self.filename = os.path.basename(file_path) self.architectures = ['i386'] self.suite_name = '-'.join([spph.distroseries.name, spph.pocket.name]) -self.raw_content = open(file_path).read() +with open(file_path, 'rb') as f: +self.raw_content = f.read() self.signingkey = None parseChanges = FakeMethod([]) diff --git a/lib/lp/soyuz/doc/distroseriesqueue-notify.txt b/lib/lp/soyuz/doc/distroseriesqueue-notify.txt index 42cfdbc..1fb94fe 100644 --- a/lib/lp/soyuz/doc/distroseriesqueue-notify.txt +++ b/lib/lp/soyuz/doc/distroseriesqueue-notify.txt @@ -43,7 +43,7 @@ this doctest. >>> changes_file_path = datadir( ... 'suite/netapplet_1.0-1/netapplet_1.0-1_source.changes') ->>> changes_file = open(changes_file_path,'r') +>>> changes_file = open(changes_file_path, 'rb') >>> from lp.services.log.logger import FakeLogger >>> netapplet_upload.notify( ... changes_file_object=changes_file, logger=FakeLogger()) @@ -117,7 +117,7 @@ Now request the email: >>> changes_file_path = datadir( ... 'suite/netapplet_1.0-1-signed/netapplet_1.0-1_source.changes') ->>> changes_file = open(changes_file_path,'r') +>>> changes_file = open(changes_file_path, 'rb') >>> netapplet_upload.setAccepted() >>> netapplet_upload.notify( ... changes_file_object=changes_file, logger=FakeLogger()) @@ -217,7 +217,7 @@ parameter provided that everything is already committed to the database demonstrates this usage: >>> from lp.services.librarianserver.testing.server import fillLibrarianFile ->>> changes_file = open(changes_file_path,"r") +>>> changes_file = open(changes_file_path, "rb") >>> fillLibrarianFile(1, content=changes_file.read()) >>> changes_file.close() >>> from lp.soyuz.enums import PackageUploadStatus diff --git a/lib/lp/soyuz/model/sourcepackagerelease.py
[Launchpad-reviewers] [Merge] ~pappacena/launchpad:snap-pillar-subscribe-ui into launchpad:master
The proposal to merge ~pappacena/launchpad:snap-pillar-subscribe-ui into launchpad:master has been updated. Status: Needs review => Work in progress For more details, see: https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/398319 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:snap-pillar-subscribe-ui into launchpad:master. ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master. Commit message: Stabilize file map ordering when dispatching to builders Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398547 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master. diff --git a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py index 63b67a7..8fab8ae 100644 --- a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py +++ b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py @@ -9,6 +9,7 @@ __all__ = [ 'BuildFarmJobBehaviourBase', ] +from collections import OrderedDict from datetime import datetime import gzip import logging @@ -133,7 +134,7 @@ class BuildFarmJobBehaviourBase: chroot = pocket_chroot.chroot args["image_type"] = pocket_chroot.image_type.name.lower() -filename_to_sha1 = {} +filename_to_sha1 = OrderedDict() dl = [] dl.append(self._slave.sendFileToSlave( logger=logger, url=chroot.http_url, sha1=chroot.content.sha1)) diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py index baf8884..dd3a313 100644 --- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py +++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py @@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type +from collections import OrderedDict from datetime import datetime import hashlib import os @@ -164,11 +165,12 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase): run_tests_with = AsynchronousDeferredRunTest def makeBehaviour(self, das): -files = { -'foo.dsc': {'url': 'http://host/foo.dsc', 'sha1': '0'}, -'bar.tar': { +files = OrderedDict([ +('foo.dsc', {'url': 'http://host/foo.dsc', 'sha1': '0'}), +('bar.tar', { 'url': 'http://host/bar.tar', 'sha1': '0', -'username': 'admin', 'password': 'sekrit'}} +'username': 'admin', 'password': 'sekrit'}), +]) behaviour = BuildFarmJobBehaviourBase(FakeBuildFarmJob()) behaviour.composeBuildRequest = FakeMethod( @@ -182,8 +184,8 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase): expected_calls = [ ('ensurepresent', 'http://librarian.test/%s' % chroot_filename, '', ''), -('ensurepresent', 'http://host/bar.tar', 'admin', 'sekrit'), ('ensurepresent', 'http://host/foo.dsc', '', ''), +('ensurepresent', 'http://host/bar.tar', 'admin', 'sekrit'), ('build', 'PACKAGEBUILD-1', 'foobuild', hashlib.sha1(six.ensure_binary(chroot_filename)).hexdigest(), ['foo.dsc', 'bar.tar'], diff --git a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py index afb1df9..3ff5603 100644 --- a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py +++ b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py @@ -9,6 +9,8 @@ __all__ = [ 'BinaryPackageBuildBehaviour', ] +from collections import OrderedDict + from twisted.internet import defer from zope.interface import implementer @@ -71,7 +73,7 @@ class BinaryPackageBuildBehaviour(BuildFarmJobBehaviourBase): makePoolPath( self.build.source_package_release.sourcepackagename.name, self.build.current_component.name)) -filemap = {} +filemap = OrderedDict() for source_file in self.build.source_package_release.files: lfa = source_file.libraryfile if not self.build.archive.private: ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-doctest-set-repr-2 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-doctest-set-repr-2 into launchpad:master. Commit message: Adjust doctests for repr of sets in Python 3 (take 2) Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398535 Similar to https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396934, but I missed a spot. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-doctest-set-repr-2 into launchpad:master. diff --git a/lib/lp/bugs/tests/structural-subscription-target.txt b/lib/lp/bugs/tests/structural-subscription-target.txt index 0602c9f..904f0ca 100644 --- a/lib/lp/bugs/tests/structural-subscription-target.txt +++ b/lib/lp/bugs/tests/structural-subscription-target.txt @@ -53,5 +53,5 @@ Structural subscriptions and indirect bug subscriptions ... subscriber.name for subscriber in bug.getIndirectSubscribers()) >>> structural_subscribers = set( ... sub.subscriber.name for sub in target.bug_subscriptions) ->>> structural_subscribers.difference(indirect_subscribers) -set([]) +>>> for name in structural_subscribers.difference(indirect_subscribers): +... print(name) ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:pickle-protocol-2 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:pickle-protocol-2 into launchpad:master. Commit message: Fix pickle protocol to 2 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398534 This ensures compatibility with Python 2, so that when we start upgrading production systems to Python 3 we won't cause problems for systems still on Python 2. I left lp.services.testing.profiled alone, since that's only for communication between test processes. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:pickle-protocol-2 into launchpad:master. diff --git a/lib/launchpad_loggerhead/session.py b/lib/launchpad_loggerhead/session.py index f2d3e9b..c78c021 100644 --- a/lib/launchpad_loggerhead/session.py +++ b/lib/launchpad_loggerhead/session.py @@ -63,6 +63,7 @@ class SessionHandler(object): # if the value is non-empty *or* if it was non-empty at the start # of the request. if existed or session: -environ[self.session_var] = pickle.dumps(session) +# Use protocol 2 for Python 2 compatibility. +environ[self.session_var] = pickle.dumps(session, protocol=2) return start_response(status, response_headers, exc_info) return self.application(environ, response_hook) diff --git a/lib/lp/registry/tests/test_teammembership.py b/lib/lp/registry/tests/test_teammembership.py index 3d69231..97951d1 100644 --- a/lib/lp/registry/tests/test_teammembership.py +++ b/lib/lp/registry/tests/test_teammembership.py @@ -1292,7 +1292,8 @@ class TestCheckTeamParticipationScript(TestCase): filename_out = tempdir.join("info.out") fout = bz2.BZ2File(filename_in, "w") try: -pickle.dump(info, fout, pickle.HIGHEST_PROTOCOL) +# Use protocol 2 for Python 2 compatibility. +pickle.dump(info, fout, protocol=2) finally: fout.close() code, out, err = self._runScript( diff --git a/lib/lp/services/utils.py b/lib/lp/services/utils.py index 6146e3e..a8de8e0 100644 --- a/lib/lp/services/utils.py +++ b/lib/lp/services/utils.py @@ -319,7 +319,8 @@ def save_bz2_pickle(obj, filename): """Save a bz2 compressed pickle of `obj` to `filename`.""" fout = bz2.BZ2File(filename, "w") try: -pickle.dump(obj, fout, pickle.HIGHEST_PROTOCOL) +# Use protocol 2 for Python 2 compatibility. +pickle.dump(obj, fout, protocol=2) finally: fout.close() diff --git a/lib/lp/services/webapp/pgsession.py b/lib/lp/services/webapp/pgsession.py index 5d110af..a7d4db6 100644 --- a/lib/lp/services/webapp/pgsession.py +++ b/lib/lp/services/webapp/pgsession.py @@ -196,7 +196,8 @@ class PGSessionPkgData(MutableMapping, PGSessionBase): def __setitem__(self, key, value): key = ensure_unicode(key) -pickled_value = pickle.dumps(value, pickle.HIGHEST_PROTOCOL) +# Use protocol 2 for Python 2 compatibility. +pickled_value = pickle.dumps(value, protocol=2) self.session_data._ensureClientId() self.store.execute( ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-test-zcmldirectives into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-zcmldirectives into launchpad:master. Commit message: Port zcmldirectives.txt to Python 3 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398529 It doesn't seem necessary any more to use a classic class, and those no longer exist on Python 3. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-zcmldirectives into launchpad:master. diff --git a/lib/lp/services/webapp/doc/zcmldirectives.txt b/lib/lp/services/webapp/doc/zcmldirectives.txt index e70ceed..c5c0b84 100644 --- a/lib/lp/services/webapp/doc/zcmldirectives.txt +++ b/lib/lp/services/webapp/doc/zcmldirectives.txt @@ -57,11 +57,7 @@ default view for the IFooLayer layer. ... pass >>> request = Request() ->>> import types >>> class FooView: -... """classic class that is used for a view on an IFoo""" -... __metaclass__ = types.ClassType -... ... def __call__(self): ... return "FooView was called" >>> lp.testing.FooView = FooView ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-TestDistroSeriesQueueRosettaTranslationsTarball into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-TestDistroSeriesQueueRosettaTranslationsTarball into launchpad:master. Commit message: Fix TestDistroSeriesQueueRosettaTranslationsTarball for Python 3 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398528 The fileobj passed to TarFile.open must be opened in binary mode; but we might as well just pass in a path instead, since that's simpler. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-TestDistroSeriesQueueRosettaTranslationsTarball into launchpad:master. diff --git a/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py b/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py index 75559c0..0f05f58 100644 --- a/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py +++ b/lib/lp/soyuz/tests/test_distroseriesqueue_rosetta_translations.py @@ -98,8 +98,9 @@ class TestDistroSeriesQueueRosettaTranslationsTarball( self.assertEqual(1, len(upload.queue_root.customfiles)) def _getImportableFilesFromTarball(self): -tarball = TarFile.open(mode="r:gz", fileobj=open(datadir( -"rosetta-translations/%s" % self.translations_file))) +tarball_path = datadir( +"rosetta-translations/%s" % self.translations_file) +tarball = TarFile.open(name=tarball_path, mode="r:gz") return [relpath(file_, "./source/") for file_ in tarball.getnames() if ".po" in file_] ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-poparser-unescape into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-poparser-unescape into launchpad:master. Commit message: Port POParser._unescapeNumericCharSequence to Python 3 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398527 The string_escape codec no longer exists, so we need a slightly different approach. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-poparser-unescape into launchpad:master. diff --git a/lib/lp/translations/utilities/gettext_po_parser.py b/lib/lp/translations/utilities/gettext_po_parser.py index d814bf3..925af2d 100644 --- a/lib/lp/translations/utilities/gettext_po_parser.py +++ b/lib/lp/translations/utilities/gettext_po_parser.py @@ -691,7 +691,12 @@ class POParser(object): # We found some text escaped that should be recoded to Unicode. # First, we unescape it. escaped_string, string = string[:position], string[position:] -unescaped_string = escaped_string.decode('string-escape') +# Effectively a bytes-to-bytes string-escape decoding, but +# compatible with Python 3. This works because we've already +# ensured above that escaped_string only includes hexadecimal or +# octal escapes (not \u etc.). +unescaped_string = escaped_string.encode('ascii').decode( +'unicode-escape').encode('iso-8859-1') if (self._translation_file is not None and self._translation_file.header is not None): ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-TestLaunchpadCookieClientIdManager into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-TestLaunchpadCookieClientIdManager into launchpad:master. Commit message: Adjust TestLaunchpadCookieClientIdManager for Python 3 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398526 Unlike Python 2's cookielib, Python 3's http.cookies prefers to spell "httponly" as "HttpOnly". -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-TestLaunchpadCookieClientIdManager into launchpad:master. diff --git a/lib/lp/services/webapp/tests/test_session.py b/lib/lp/services/webapp/tests/test_session.py index b99ff4f..84e94cd 100644 --- a/lib/lp/services/webapp/tests/test_session.py +++ b/lib/lp/services/webapp/tests/test_session.py @@ -67,7 +67,7 @@ class TestLaunchpadCookieClientIdManager(TestCase): request = LaunchpadTestRequest() LaunchpadCookieClientIdManager().setRequestId(request, 'some-id') self.assertThat( -dict(request.response.getHeaders())['Set-Cookie'], +dict(request.response.getHeaders())['Set-Cookie'].lower(), Contains('; httponly;')) def test_stable_client_id(self): ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:py3-test-propertycache into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-test-propertycache into launchpad:master. Commit message: Adjust propertycache.txt for Python 3 Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398525 The populate functions now have a slightly different repr, due to the removal of the concept of unbound methods from Python 3. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-test-propertycache into launchpad:master. diff --git a/lib/lp/services/doc/propertycache.txt b/lib/lp/services/doc/propertycache.txt index cd1fadf..4930b01 100644 --- a/lib/lp/services/doc/propertycache.txt +++ b/lib/lp/services/doc/propertycache.txt @@ -143,7 +143,7 @@ as "a_in_cache" in the cache. >>> Foo.a.name 'a_in_cache' >>> Foo.a.populate - + >>> foo.a 1234 @@ -158,7 +158,7 @@ cache too. >>> Foo.b.name 'b' >>> Foo.b.populate - + >>> foo.b 5678 ___ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp
[Launchpad-reviewers] [Merge] ~cjwatson/launchpad:fix-py3-services-future-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-py3-services-future-imports into launchpad:master. Commit message: Fix a few test failures with lp.services future imports Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398521 -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-py3-services-future-imports into launchpad:master. diff --git a/lib/lp/services/gpg/doc/gpg-encryption.txt b/lib/lp/services/gpg/doc/gpg-encryption.txt index 7bef091..952738a 100644 --- a/lib/lp/services/gpg/doc/gpg-encryption.txt +++ b/lib/lp/services/gpg/doc/gpg-encryption.txt @@ -57,7 +57,7 @@ cipher constains the encrypted content. Storing the raw password may compromise the security, but is the only way we can decrypt the cipher content. ->>> password = 'test' +>>> password = six.ensure_str('test') >>> plain = decrypt_content(cipher, password) voilá, the same content shows up again. @@ -69,7 +69,7 @@ Verify if the encrytion process support passing another charset string >>> content = u'a\xe7ucar' >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) ->>> plain = decrypt_content(cipher, 'test') +>>> plain = decrypt_content(cipher, six.ensure_str('test')) >>> print(backslashreplace(plain.decode('iso-8859-1'))) a\xe7ucar @@ -85,7 +85,7 @@ Decrypt a unicode content: >>> content = u'a\xe7ucar' >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) >>> cipher = six.ensure_text(cipher) ->>> plain = decrypt_content(cipher, 'test') +>>> plain = decrypt_content(cipher, six.ensure_str('test')) Traceback (most recent call last): ... TypeError: Content must be bytes. @@ -113,7 +113,7 @@ What about a message encrypted for an unknown key. ... =LQK5 ... -END PGP MESSAGE- ... """ ->>> plain = decrypt_content(cipher, 'test') +>>> plain = decrypt_content(cipher, six.ensure_str('test')) >>> plain is None True diff --git a/lib/lp/services/webapp/doc/webapp-authorization.txt b/lib/lp/services/webapp/doc/webapp-authorization.txt index 7269cbd..b24ae1b 100644 --- a/lib/lp/services/webapp/doc/webapp-authorization.txt +++ b/lib/lp/services/webapp/doc/webapp-authorization.txt @@ -25,7 +25,7 @@ If the permission doesn't exist, it raises an error: >>> check_permission('mushroom.Badger', sample_person) Traceback (most recent call last): ... -ValueError: ('Undefined permission ID', 'mushroom.Badger') +ValueError: ('Undefined permission ID', ...'mushroom.Badger') >>> logout() diff --git a/lib/lp/services/webapp/doc/xmlrpc-infrastructure.txt b/lib/lp/services/webapp/doc/xmlrpc-infrastructure.txt index 747e15a..3707bcf 100644 --- a/lib/lp/services/webapp/doc/xmlrpc-infrastructure.txt +++ b/lib/lp/services/webapp/doc/xmlrpc-infrastructure.txt @@ -8,10 +8,10 @@ LaunchpadXMLRPCView. You get access to the context and the request, as you would expect. ->>> viewobj.context -'somecontext' ->>> viewobj.request -'somerequest' +>>> print(viewobj.context) +somecontext +>>> print(viewobj.request) +somerequest Like a LaunchpadView, you can get 'self.user', which is the currently logged-in user, or None when there is no user logged in. diff --git a/lib/lp/services/webservice/doc/launchpadlib.txt b/lib/lp/services/webservice/doc/launchpadlib.txt index 30e7142..a44050e 100644 --- a/lib/lp/services/webservice/doc/launchpadlib.txt +++ b/lib/lp/services/webservice/doc/launchpadlib.txt @@ -4,12 +4,14 @@ Just to show that we're actually talking to the appserver, first check to see if a specific user exists... >>> browser = Browser() ->>> browser.addHeader('Authorization', 'Basic foo@canonical.com:test') +>>> browser.addHeader( +... 'Authorization', +... six.ensure_str('Basic foo@canonical.com:test')) >>> from lp.testing.layers import BaseLayer >>> root_url = BaseLayer.appserver_root_url() >>> browser.open(root_url) ->>> browser.vhost -'http://launchpad.test' +>>> print(browser.vhost) +http://launchpad.test >>> browser.urlpath '/' @@ -25,7 +27,7 @@ if a specific user exists... >>> browser.getControl(name='field.name').value = 'stimpy' >>> browser.getControl('Display Name').value = 'Stimpson J. Cat' >>> browser.getControl('Create').click() ->>> browser.vhost -'http://launchpad.test' +>>> print(browser.vhost) +http://launchpad.test >>> browser.urlpath '/~stimpy' diff --git a/lib/lp/testing/browser.py b/lib/lp/testing/browser.py index aed02bc..155eccf 100644 --- a/lib/lp/testing/browser.py +++ b/lib/lp/testing/browser.py @@ -20,6 +20,7 @@ import __future__ import ssl from lazr.uri import URI +import six from urllib3 import