launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05139
[Merge] lp:~allenap/txlongpoll/amqp-longpoll-to-txlongpoll into lp:txlongpoll
Gavin Panella has proposed merging lp:~allenap/txlongpoll/amqp-longpoll-to-txlongpoll into lp:txlongpoll.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~allenap/txlongpoll/amqp-longpoll-to-txlongpoll/+merge/77678
This adds a txlongpoll synonym for the amqp-longpoll plugin, and deprecates the latter. It also formats all the imports in Launchpad style, for which the Landscape team may want to skin me.
--
https://code.launchpad.net/~allenap/txlongpoll/amqp-longpoll-to-txlongpoll/+merge/77678
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/txlongpoll/amqp-longpoll-to-txlongpoll into lp:txlongpoll.
=== modified file 'setup.py'
--- setup.py 2011-09-29 14:55:35 +0000
+++ setup.py 2011-09-30 10:00:18 +0000
@@ -4,7 +4,10 @@
"""Distutils installer for txlongpoll."""
-from setuptools import setup, find_packages
+from setuptools import (
+ find_packages,
+ setup,
+ )
setup(
=== renamed file 'twisted/plugins/longpoll.py' => 'twisted/plugins/txlongpoll.py'
--- twisted/plugins/longpoll.py 2011-09-29 13:57:01 +0000
+++ twisted/plugins/txlongpoll.py 2011-09-30 10:00:18 +0000
@@ -1,10 +1,10 @@
# Copyright 2005-2011 Canonical Ltd. This software is licensed under
# the GNU Affero General Public License version 3 (see the file LICENSE).
+from __future__ import absolute_import
+
import signal
-from zope.interface import implements
-
from oops_datedir_repo import DateDirRepo
from oops_twisted import (
Config as oops_config,
@@ -12,19 +12,31 @@
OOPSObserver,
)
import setproctitle
-from twisted.application.internet import TCPServer, TCPClient
-from twisted.application.service import IServiceMaker, MultiService
+from twisted.application.internet import (
+ TCPClient,
+ TCPServer,
+ )
+from twisted.application.service import (
+ IServiceMaker,
+ MultiService,
+ )
from twisted.plugin import IPlugin
-from twisted.python import log, usage
+from twisted.python import (
+ log,
+ usage,
+ )
from twisted.python.log import (
addObserver,
- FileLogObserver
+ FileLogObserver,
)
from twisted.python.logfile import LogFile
from twisted.web.server import Site
-
from txlongpoll.client import AMQFactory
-from txlongpoll.frontend import QueueManager, FrontEndAjax
+from txlongpoll.frontend import (
+ FrontEndAjax,
+ QueueManager,
+ )
+from zope.interface import implements
def getRotatableLogFileObserver(filename):
@@ -83,16 +95,19 @@
class AMQServiceMaker(object):
"""Create an asynchronous frontend server for AMQP."""
+
implements(IServiceMaker, IPlugin)
- tapname = "amqp-longpoll"
- description = "An AMQP long-poll HTTP service."
options = Options
+ def __init__(self, name, description):
+ self.tapname = name
+ self.description = description
+
def makeService(self, options):
- """Construct a TCPServer and TCPClient. """
+ """Construct a TCPServer and TCPClient."""
setproctitle.setproctitle(
- "txlongpoll: accepting connections on %s" %
+ "txlongpoll: accepting connections on %s" %
options["frontendport"])
setUpOopsHandler(options)
@@ -120,8 +135,14 @@
return services
-# Now construct an object which *provides* the relevant interfaces
-# The name of this variable is irrelevant, as long as there is *some*
-# name bound to a provider of IPlugin and IServiceMaker.
-
-serviceMaker = AMQServiceMaker()
+# Now construct objects which *provide* the relevant interfaces. The name of
+# these variables is irrelevant, as long as there are *some* names bound to
+# providers of IPlugin and IServiceMaker.
+
+service_amqp_longpoll = AMQServiceMaker(
+ "amqp-longpoll", "An AMQP -> HTTP long-poll bridge. *Note* that "
+ "the `amqp-longpoll' name is deprecated; please use `txlongpoll' "
+ "instead.")
+
+service_txlongpoll = AMQServiceMaker(
+ "txlongpoll", "An AMQP -> HTTP long-poll bridge.")
=== modified file 'txlongpoll/client.py'
--- txlongpoll/client.py 2011-09-19 10:09:55 +0000
+++ txlongpoll/client.py 2011-09-30 10:00:18 +0000
@@ -7,13 +7,12 @@
import os.path
+from twisted.internet.defer import maybeDeferred
from twisted.internet.protocol import ReconnectingClientFactory
-from twisted.internet.defer import maybeDeferred
-
+from txamqp.client import TwistedDelegate
from txamqp.protocol import AMQClient
-from txamqp.client import TwistedDelegate
+from txamqp.queue import Closed
from txamqp.spec import load as load_spec
-from txamqp.queue import Closed
class AMQClientWithCallback(AMQClient):
=== modified file 'txlongpoll/frontend.py'
--- txlongpoll/frontend.py 2011-09-29 13:57:01 +0000
+++ txlongpoll/frontend.py 2011-09-30 10:00:18 +0000
@@ -7,16 +7,25 @@
import json
-from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
+from twisted.internet.defer import (
+ Deferred,
+ inlineCallbacks,
+ returnValue,
+ )
from twisted.python import log
-
+from twisted.web.http import (
+ BAD_REQUEST,
+ INTERNAL_SERVER_ERROR,
+ NOT_FOUND,
+ REQUEST_TIMEOUT,
+ )
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
-from twisted.web.http import (
- BAD_REQUEST, INTERNAL_SERVER_ERROR, REQUEST_TIMEOUT, NOT_FOUND)
-
-from txamqp.queue import Empty, Closed as QueueClosed
from txamqp.client import Closed
+from txamqp.queue import (
+ Closed as QueueClosed,
+ Empty,
+ )
__all__ = ["QueueManager", "FrontEndAjax"]
=== modified file 'txlongpoll/testing/client.py'
--- txlongpoll/testing/client.py 2011-07-12 11:53:56 +0000
+++ txlongpoll/testing/client.py 2011-09-30 10:00:18 +0000
@@ -1,6 +1,7 @@
# Copyright 2005-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from rabbitfixture.server import RabbitServer
from testresources import (
FixtureResource,
ResourcedTestCase,
@@ -9,13 +10,14 @@
from testtools.deferredruntest import (
AsynchronousDeferredRunTestForBrokenTwisted,
)
-from twisted.internet.defer import Deferred, inlineCallbacks, DeferredQueue
from twisted.internet import reactor
-
+from twisted.internet.defer import (
+ Deferred,
+ DeferredQueue,
+ inlineCallbacks,
+ )
from txamqp.client import Closed
-
from txlongpoll.client import AMQFactory
-from rabbitfixture.server import RabbitServer
class QueueWrapper(object):
=== modified file 'txlongpoll/tests/test_client.py'
--- txlongpoll/tests/test_client.py 2011-09-19 10:09:55 +0000
+++ txlongpoll/tests/test_client.py 2011-09-30 10:00:18 +0000
@@ -5,15 +5,16 @@
Tests for C{AMQFactory}.
"""
-from unittest import TestCase, defaultTestLoader
+from unittest import (
+ defaultTestLoader,
+ TestCase,
+ )
from testtools.deferredruntest import flush_logged_errors
from twisted.internet.defer import Deferred
-
-from txamqp.spec import Spec
from txamqp.protocol import AMQChannel
from txamqp.queue import Closed
-
+from txamqp.spec import Spec
from txlongpoll.client import AMQFactory
from txlongpoll.testing.client import AMQTest
=== modified file 'txlongpoll/tests/test_frontend.py'
--- txlongpoll/tests/test_frontend.py 2011-09-29 13:57:01 +0000
+++ txlongpoll/tests/test_frontend.py 2011-09-30 10:00:18 +0000
@@ -1,22 +1,38 @@
# Copyright 2005-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+from cStringIO import StringIO
+import json
from unittest import defaultTestLoader
-import json
-from cStringIO import StringIO
from testtools import TestCase
from testtools.deferredruntest import assert_fails_with
-from twisted.internet.task import Clock, deferLater
-from twisted.internet.defer import inlineCallbacks, succeed, fail, Deferred
from twisted.internet import reactor
-
-from txamqp.protocol import AMQChannel, AMQClient
+from twisted.internet.defer import (
+ Deferred,
+ fail,
+ inlineCallbacks,
+ succeed,
+ )
+from twisted.internet.task import (
+ Clock,
+ deferLater,
+ )
+from txamqp.content import Content
+from txamqp.protocol import (
+ AMQChannel,
+ AMQClient,
+ )
from txamqp.queue import Empty
-from txamqp.content import Content
-
-from txlongpoll.frontend import QueueManager, FrontEndAjax, NotFound
-from txlongpoll.testing.client import AMQTest, QueueWrapper
+from txlongpoll.frontend import (
+ FrontEndAjax,
+ NotFound,
+ QueueManager,
+ )
+from txlongpoll.testing.client import (
+ AMQTest,
+ QueueWrapper,
+ )
class QueueManagerTest(AMQTest):