Merge lp:~jml/launchpad/old-twisted-bugs into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Aaron Bentley
Approved revision: no longer in the source branch.
Merged at revision: 12706
Proposed branch: lp:~jml/launchpad/old-twisted-bugs
Merge into: lp:launchpad
Diff against target: 156 lines (+14/-42)
6 files modified
lib/lp/buildmaster/tests/mock_slaves.py (+0/-3)
lib/lp/codehosting/__init__.py (+3/-12)
lib/lp/codehosting/codeimport/tests/test_workermonitor.py (+0/-4)
lib/lp/codehosting/scanner/bzrsync.py (+1/-1)
lib/lp/services/twistedsupport/xmlrpc.py (+0/-22)
lib/lp/services/utils.py (+10/-0)
To merge this branch: bzr merge lp:~jml/launchpad/old-twisted-bugs
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Review via email: mp+55569@code.launchpad.net

Commit message

[r=abentley][no-qa] Remove workaround for Twisted bug that has since been fixed upstream.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/buildmaster/tests/mock_slaves.py'
2--- lib/lp/buildmaster/tests/mock_slaves.py 2011-02-01 18:14:57 +0000
3+++ lib/lp/buildmaster/tests/mock_slaves.py 2011-03-30 15:20:46 +0000
4@@ -25,7 +25,6 @@
5 import os
6 import types
7
8-from StringIO import StringIO
9 import xmlrpclib
10
11 from testtools.content import Content
12@@ -48,10 +47,8 @@
13 from lp.soyuz.model.binarypackagebuildbehavior import (
14 BinaryPackageBuildBehavior,
15 )
16-from lp.services.twistedsupport.xmlrpc import fix_bug_2518
17 from lp.testing.sampledata import I386_ARCHITECTURE_NAME
18
19-fix_bug_2518()
20
21 def make_publisher():
22 """Make a Soyuz test publisher."""
23
24=== modified file 'lib/lp/codehosting/__init__.py'
25--- lib/lp/codehosting/__init__.py 2011-02-18 18:43:16 +0000
26+++ lib/lp/codehosting/__init__.py 2011-03-30 15:20:46 +0000
27@@ -11,7 +11,6 @@
28 __all__ = [
29 'get_bzr_path',
30 'get_BZR_PLUGIN_PATH_for_subprocess',
31- 'iter_list_chunks',
32 'load_optional_plugin',
33 ]
34
35@@ -25,15 +24,6 @@
36 from canonical.config import config
37
38
39-def iter_list_chunks(a_list, size):
40- """Iterate over `a_list` in chunks of size `size`.
41-
42- I'm amazed this isn't in itertools (mwhudson).
43- """
44- for i in range(0, len(a_list), size):
45- yield a_list[i:i+size]
46-
47-
48 def get_bzr_path():
49 """Find the path to the copy of Bazaar for this rocketfuel instance"""
50 bzr_in_egg_path = os.path.join(
51@@ -88,6 +78,7 @@
52 del self._callback_names[name]
53
54
55-# Monkeypatch: Branch.hooks is a list in bzr 1.13, so it supports remove.
56-# It is a HookPoint in bzr 1.14, so add HookPoint.remove.
57+# XXX: JonathanLange 2011-03-30 bug=301472: Monkeypatch: Branch.hooks is a
58+# list in bzr 1.13, so it supports remove. It is a HookPoint in bzr 1.14, so
59+# add HookPoint.remove.
60 hooks.HookPoint.remove = remove_hook
61
62=== modified file 'lib/lp/codehosting/codeimport/tests/test_workermonitor.py'
63--- lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2010-12-20 03:21:03 +0000
64+++ lib/lp/codehosting/codeimport/tests/test_workermonitor.py 2011-03-30 15:20:46 +0000
65@@ -74,7 +74,6 @@
66 makeFailure,
67 ProcessTestsMixin,
68 )
69-from lp.services.twistedsupport.xmlrpc import fix_bug_2518
70 from lp.testing import (
71 login,
72 logout,
73@@ -83,9 +82,6 @@
74 from lp.testing.factory import LaunchpadObjectFactory
75
76
77-fix_bug_2518()
78-
79-
80 class TestWorkerMonitorProtocol(ProcessTestsMixin, TestCase):
81
82 class StubWorkerMonitor:
83
84=== modified file 'lib/lp/codehosting/scanner/bzrsync.py'
85--- lib/lp/codehosting/scanner/bzrsync.py 2011-02-23 01:24:09 +0000
86+++ lib/lp/codehosting/scanner/bzrsync.py 2011-03-30 15:20:46 +0000
87@@ -30,8 +30,8 @@
88 from lp.code.interfaces.revision import IRevisionSet
89 from lp.code.model.branchrevision import (BranchRevision)
90 from lp.code.model.revision import Revision
91-from lp.codehosting import iter_list_chunks
92 from lp.codehosting.scanner import events
93+from lp.services.utils import iter_list_chunks
94 from lp.translations.interfaces.translationtemplatesbuildjob import (
95 ITranslationTemplatesBuildJobSource,
96 )
97
98=== modified file 'lib/lp/services/twistedsupport/xmlrpc.py'
99--- lib/lp/services/twistedsupport/xmlrpc.py 2010-11-21 14:18:50 +0000
100+++ lib/lp/services/twistedsupport/xmlrpc.py 2011-03-30 15:20:46 +0000
101@@ -50,28 +50,6 @@
102 method_name, *args, **kwargs)
103
104
105-class DisconnectingQueryProtocol(xmlrpc.QueryProtocol):
106-
107- def connectionMade(self):
108- self._response = None
109- xmlrpc.QueryProtocol.connectionMade(self)
110-
111- def handleResponse(self, contents):
112- self.transport.loseConnection()
113- self._response = contents
114-
115- def connectionLost(self, reason):
116- xmlrpc.QueryProtocol.connectionLost(self, reason)
117- if self._response is not None:
118- response, self._response = self._response, None
119- self.factory.parseResponse(response)
120-
121-
122-def fix_bug_2518():
123- # XXX: See http://twistedmatrix.com/trac/ticket/2518.
124- xmlrpc._QueryFactory.protocol = DisconnectingQueryProtocol
125-
126-
127 def trap_fault(failure, *fault_classes):
128 """Trap a fault, based on fault code.
129
130
131=== modified file 'lib/lp/services/utils.py'
132--- lib/lp/services/utils.py 2011-02-20 13:26:48 +0000
133+++ lib/lp/services/utils.py 2011-03-30 15:20:46 +0000
134@@ -15,6 +15,7 @@
135 'compress_hash',
136 'decorate_with',
137 'docstring_dedent',
138+ 'iter_list_chunks',
139 'iter_split',
140 'run_capturing_output',
141 'synchronize',
142@@ -119,6 +120,15 @@
143 yield splitter.join(tokens[:i]), splitter.join(tokens[i:])
144
145
146+def iter_list_chunks(a_list, size):
147+ """Iterate over `a_list` in chunks of size `size`.
148+
149+ I'm amazed this isn't in itertools (mwhudson).
150+ """
151+ for i in range(0, len(a_list), size):
152+ yield a_list[i:i+size]
153+
154+
155 def synchronize(source, target, add, remove):
156 """Update 'source' to match 'target' using 'add' and 'remove'.
157