launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03120
[Merge] lp:~jml/launchpad/old-twisted-bugs into lp:launchpad
Jonathan Lange has proposed merging lp:~jml/launchpad/old-twisted-bugs into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jml/launchpad/old-twisted-bugs/+merge/55569
This branch cleans up a work-around for a problem that has been fixed upstream, http://tm.tl/2518. In the branch I had also tried to remove what looked like an old work-around from a Bazaar upgrade, but that didn't work out. You can see the legacy of that attempt in the moved helper method and the updated comment.
--
https://code.launchpad.net/~jml/launchpad/old-twisted-bugs/+merge/55569
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/old-twisted-bugs into lp:launchpad.
=== modified file 'lib/lp/buildmaster/tests/mock_slaves.py'
--- lib/lp/buildmaster/tests/mock_slaves.py 2011-02-01 18:14:57 +0000
+++ lib/lp/buildmaster/tests/mock_slaves.py 2011-03-30 15:20:46 +0000
@@ -25,7 +25,6 @@
import os
import types
-from StringIO import StringIO
import xmlrpclib
from testtools.content import Content
@@ -48,10 +47,8 @@
from lp.soyuz.model.binarypackagebuildbehavior import (
BinaryPackageBuildBehavior,
)
-from lp.services.twistedsupport.xmlrpc import fix_bug_2518
from lp.testing.sampledata import I386_ARCHITECTURE_NAME
-fix_bug_2518()
def make_publisher():
"""Make a Soyuz test publisher."""
=== modified file 'lib/lp/codehosting/__init__.py'
--- lib/lp/codehosting/__init__.py 2011-02-18 18:43:16 +0000
+++ lib/lp/codehosting/__init__.py 2011-03-30 15:20:46 +0000
@@ -11,7 +11,6 @@
__all__ = [
'get_bzr_path',
'get_BZR_PLUGIN_PATH_for_subprocess',
- 'iter_list_chunks',
'load_optional_plugin',
]
@@ -25,15 +24,6 @@
from canonical.config import config
-def iter_list_chunks(a_list, size):
- """Iterate over `a_list` in chunks of size `size`.
-
- I'm amazed this isn't in itertools (mwhudson).
- """
- for i in range(0, len(a_list), size):
- yield a_list[i:i+size]
-
-
def get_bzr_path():
"""Find the path to the copy of Bazaar for this rocketfuel instance"""
bzr_in_egg_path = os.path.join(
@@ -88,6 +78,7 @@
del self._callback_names[name]
-# Monkeypatch: Branch.hooks is a list in bzr 1.13, so it supports remove.
-# It is a HookPoint in bzr 1.14, so add HookPoint.remove.
+# XXX: JonathanLange 2011-03-30 bug=301472: Monkeypatch: Branch.hooks is a
+# list in bzr 1.13, so it supports remove. It is a HookPoint in bzr 1.14, so
+# add HookPoint.remove.
hooks.HookPoint.remove = remove_hook
=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2010-12-20 03:21:03 +0000
+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2011-03-30 15:20:46 +0000
@@ -74,7 +74,6 @@
makeFailure,
ProcessTestsMixin,
)
-from lp.services.twistedsupport.xmlrpc import fix_bug_2518
from lp.testing import (
login,
logout,
@@ -83,9 +82,6 @@
from lp.testing.factory import LaunchpadObjectFactory
-fix_bug_2518()
-
-
class TestWorkerMonitorProtocol(ProcessTestsMixin, TestCase):
class StubWorkerMonitor:
=== modified file 'lib/lp/codehosting/scanner/bzrsync.py'
--- lib/lp/codehosting/scanner/bzrsync.py 2011-02-23 01:24:09 +0000
+++ lib/lp/codehosting/scanner/bzrsync.py 2011-03-30 15:20:46 +0000
@@ -30,8 +30,8 @@
from lp.code.interfaces.revision import IRevisionSet
from lp.code.model.branchrevision import (BranchRevision)
from lp.code.model.revision import Revision
-from lp.codehosting import iter_list_chunks
from lp.codehosting.scanner import events
+from lp.services.utils import iter_list_chunks
from lp.translations.interfaces.translationtemplatesbuildjob import (
ITranslationTemplatesBuildJobSource,
)
=== modified file 'lib/lp/services/twistedsupport/xmlrpc.py'
--- lib/lp/services/twistedsupport/xmlrpc.py 2010-11-21 14:18:50 +0000
+++ lib/lp/services/twistedsupport/xmlrpc.py 2011-03-30 15:20:46 +0000
@@ -50,28 +50,6 @@
method_name, *args, **kwargs)
-class DisconnectingQueryProtocol(xmlrpc.QueryProtocol):
-
- def connectionMade(self):
- self._response = None
- xmlrpc.QueryProtocol.connectionMade(self)
-
- def handleResponse(self, contents):
- self.transport.loseConnection()
- self._response = contents
-
- def connectionLost(self, reason):
- xmlrpc.QueryProtocol.connectionLost(self, reason)
- if self._response is not None:
- response, self._response = self._response, None
- self.factory.parseResponse(response)
-
-
-def fix_bug_2518():
- # XXX: See http://twistedmatrix.com/trac/ticket/2518.
- xmlrpc._QueryFactory.protocol = DisconnectingQueryProtocol
-
-
def trap_fault(failure, *fault_classes):
"""Trap a fault, based on fault code.
=== modified file 'lib/lp/services/utils.py'
--- lib/lp/services/utils.py 2011-02-20 13:26:48 +0000
+++ lib/lp/services/utils.py 2011-03-30 15:20:46 +0000
@@ -15,6 +15,7 @@
'compress_hash',
'decorate_with',
'docstring_dedent',
+ 'iter_list_chunks',
'iter_split',
'run_capturing_output',
'synchronize',
@@ -119,6 +120,15 @@
yield splitter.join(tokens[:i]), splitter.join(tokens[i:])
+def iter_list_chunks(a_list, size):
+ """Iterate over `a_list` in chunks of size `size`.
+
+ I'm amazed this isn't in itertools (mwhudson).
+ """
+ for i in range(0, len(a_list), size):
+ yield a_list[i:i+size]
+
+
def synchronize(source, target, add, remove):
"""Update 'source' to match 'target' using 'add' and 'remove'.
Follow ups