[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Make new bridgedb.distributors package and put distributor code there.



commit fca25fc8d9295ab50cb2a1be39199c213ddf8751
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Wed Nov 1 20:44:24 2017 +0000

    Make new bridgedb.distributors package and put distributor code there.
---
 bridgedb/Bridges.py                                |   2 +-
 bridgedb/Main.py                                   |  16 ++++----
 bridgedb/distributors/__init__.py                  |   5 +++
 bridgedb/distributors/email/__init__.py            |   8 ++++
 bridgedb/{ => distributors}/email/autoresponder.py |  24 +++++------
 bridgedb/{ => distributors}/email/distributor.py   |  10 ++---
 bridgedb/{ => distributors}/email/dkim.py          |   6 +--
 bridgedb/{ => distributors}/email/request.py       |  12 +++---
 bridgedb/{ => distributors}/email/server.py        |  30 +++++++-------
 bridgedb/{ => distributors}/email/templates.py     |   6 +--
 bridgedb/{ => distributors}/https/__init__.py      |   4 ++
 bridgedb/{ => distributors}/https/distributor.py   |   8 ++--
 bridgedb/{ => distributors}/https/request.py       |   8 ++--
 bridgedb/{ => distributors}/https/server.py        |   8 ++--
 .../https/templates/assets/css/bootstrap.min.css   |   0
 .../https/templates/assets/css/error.css           |   0
 .../templates/assets/css/font-awesome-ie7.min.css  |   0
 .../templates/assets/css/font-awesome.min.css      |   0
 .../https/templates/assets/css/main.css            |   0
 .../https/templates/assets/css/rtl.css             |   0
 .../templates/assets/font/fontawesome-webfont.eot  | Bin
 .../templates/assets/font/fontawesome-webfont.svg  |   0
 .../templates/assets/font/fontawesome-webfont.ttf  | Bin
 .../templates/assets/font/fontawesome-webfont.woff | Bin
 .../https/templates/assets/font/lato-bold.woff     | Bin
 .../https/templates/assets/font/lato-italic.woff   | Bin
 .../https/templates/assets/font/lato-regular.woff  | Bin
 .../templates/assets/images/404-excavator.svg      |   0
 .../templates/assets/images/404-hills-left.svg     |   0
 .../templates/assets/images/404-hills-right.svg    |   0
 .../assets/images/500-hills-left-shade.svg         |   0
 .../templates/assets/images/500-hills-left.svg     |   0
 .../assets/images/500-hills-right-shade.svg        |   0
 .../templates/assets/images/500-hills-right.svg    |   0
 .../https/templates/assets/images/500-road.svg     |   0
 .../assets/images/maintenance-hills-left-shade.svg |   0
 .../assets/images/maintenance-hills-left.svg       |   0
 .../images/maintenance-hills-right-shade.svg       |   0
 .../assets/images/maintenance-hills-right.svg      |   0
 .../assets/images/maintenance-tractor.svg          |   0
 .../https/templates/assets/js/bridges.js           |   0
 .../https/templates/assets/tor-roots-blue.svg      |   0
 .../https/templates/assets/tor.svg                 |   0
 .../{ => distributors}/https/templates/base.html   |   0
 .../https/templates/bridges.html                   |   0
 .../https/templates/captcha.html                   |   0
 .../https/templates/error-404.html                 |   0
 .../https/templates/error-500.html                 |   0
 .../https/templates/error-503.html                 |   0
 .../{ => distributors}/https/templates/howto.html  |   0
 .../{ => distributors}/https/templates/index.html  |   0
 .../https/templates/options.html                   |   0
 .../{ => distributors}/https/templates/robots.txt  |   0
 bridgedb/email/__init__.py                         |   1 -
 bridgedb/parse/addr.py                             |   4 +-
 bridgedb/persistent.py                             |   4 +-
 bridgedb/strings.py                                |   4 +-
 bridgedb/test/email_helpers.py                     |  14 +++----
 bridgedb/test/https_helpers.py                     |   4 +-
 bridgedb/test/legacy_Tests.py                      |   6 +--
 bridgedb/test/test_email_autoresponder.py          |  14 +++----
 bridgedb/test/test_email_distributor.py            |  12 +++---
 bridgedb/test/test_email_dkim.py                   |   4 +-
 bridgedb/test/test_email_request.py                |   4 +-
 bridgedb/test/test_email_server.py                 |  20 +++++-----
 bridgedb/test/test_email_templates.py              |   4 +-
 bridgedb/test/test_https_distributor.py            |   6 +--
 bridgedb/test/test_https_request.py                |   4 +-
 bridgedb/test/test_https_server.py                 |  44 ++++++++++-----------
 doc/sphinx/source/conf.py                          |  22 +++++------
 setup.py                                           |   9 +++--
 71 files changed, 172 insertions(+), 155 deletions(-)

diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py
index ac403b6..50d70ae 100644
--- a/bridgedb/Bridges.py
+++ b/bridgedb/Bridges.py
@@ -541,7 +541,7 @@ class FilteredBridgeSplitter(object):
         :ivar bridges: DOCDOC
         :type distributorName: str
         :ivar distributorName: The name of this splitter's distributor. See
-             :meth:`~bridgedb.https.distributor.HTTPSDistributor.setDistributorName`.
+             :meth:`~bridgedb.distributors.https.distributor.HTTPSDistributor.setDistributorName`.
         """
         self.key = key
         self.filterRings = {}
diff --git a/bridgedb/Main.py b/bridgedb/Main.py
index 4273653..53b70c2 100644
--- a/bridgedb/Main.py
+++ b/bridgedb/Main.py
@@ -31,8 +31,8 @@ from bridgedb.bridges import ServerDescriptorDigestMismatch
 from bridgedb.bridges import ServerDescriptorWithoutNetworkstatus
 from bridgedb.bridges import Bridge
 from bridgedb.configure import loadConfig
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.https.distributor import HTTPSDistributor
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.https.distributor import HTTPSDistributor
 from bridgedb.parse import descriptors
 from bridgedb.parse.blacklist import parseBridgeBlacklistFile
 
@@ -216,8 +216,8 @@ def createBridgeRings(cfg, proxyList, key):
     :param bytes key: Hashring master key
     :rtype: tuple
     :returns: A BridgeSplitter hashring, an
-        :class:`~bridgedb.https.distributor.HTTPSDistributor` or None, and an
-        :class:`~bridgedb.email.distributor.EmailDistributor` or None.
+        :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor` or None, and an
+        :class:`~bridgedb.distributors.email.distributor.EmailDistributor` or None.
     """
     # Create a BridgeSplitter to assign the bridges to the different
     # distributors.
@@ -316,8 +316,8 @@ def run(options, reactor=reactor):
 
     state = persistent.State(config=config)
 
-    from bridgedb.email.server import addServer as addSMTPServer
-    from bridgedb.https.server import addWebServer
+    from bridgedb.distributors.email.server import addServer as addSMTPServer
+    from bridgedb.distributors.https.server import addWebServer
 
     # Load the master key, or create a new one.
     key = crypto.getKey(config.MASTER_KEY_FILE)
@@ -352,9 +352,9 @@ def run(options, reactor=reactor):
         :ivar proxyList: The container for the IP addresses of any currently
             known open proxies.
         :ivar ipDistributor: A
-            :class:`~bridgedb.https.distributor.HTTPSDistributor`.
+            :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor`.
         :ivar emailDistributor: A
-            :class:`~bridgedb.email.distributor.EmailDistributor`.
+            :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
         :ivar dict tasks: A dictionary of ``{name: task}``, where name is a
             string to associate with the ``task``, and ``task`` is some
             scheduled event, repetitive or otherwise, for the :class:`reactor
diff --git a/bridgedb/distributors/__init__.py b/bridgedb/distributors/__init__.py
new file mode 100644
index 0000000..951ef44
--- /dev/null
+++ b/bridgedb/distributors/__init__.py
@@ -0,0 +1,5 @@
+"""Methods for distributing bridges."""
+
+import email
+import https
+#import moat
diff --git a/bridgedb/distributors/email/__init__.py b/bridgedb/distributors/email/__init__.py
new file mode 100644
index 0000000..8f9ed03
--- /dev/null
+++ b/bridgedb/distributors/email/__init__.py
@@ -0,0 +1,8 @@
+"""Servers for BridgeDB's email bridge distributor."""
+
+import autoresponder
+import distributor
+import dkim
+import request
+import server
+import templates
diff --git a/bridgedb/email/autoresponder.py b/bridgedb/distributors/email/autoresponder.py
similarity index 97%
rename from bridgedb/email/autoresponder.py
rename to bridgedb/distributors/email/autoresponder.py
index 430a50c..ff65a73 100644
--- a/bridgedb/email/autoresponder.py
+++ b/bridgedb/distributors/email/autoresponder.py
@@ -13,10 +13,10 @@
 #_____________________________________________________________________________
 
 """
-.. py:module:: bridgedb.email.autoresponder
+.. py:module:: bridgedb.distributors.email.autoresponder
     :synopsis: Functionality for autoresponding to incoming emails.
 
-bridgedb.email.autoresponder
+bridgedb.distributors.email.autoresponder
 ============================
 
 Functionality for autoresponding to incoming emails.
@@ -26,7 +26,7 @@ Functionality for autoresponding to incoming emails.
 
 ::
 
-  bridgedb.email.autoresponder
+  bridgedb.distributors.email.autoresponder
    | |_ createResponseBody - Parse lines from an incoming email and determine
    | |                       how to respond.
    | |_ generateResponse - Create an email response.
@@ -50,13 +50,13 @@ from twisted.python import failure
 
 from bridgedb import safelog
 from bridgedb.crypto import NEW_BUFFER_INTERFACE
-from bridgedb.email import dkim
-from bridgedb.email import request
-from bridgedb.email import templates
-from bridgedb.email.distributor import EmailRequestedHelp
-from bridgedb.email.distributor import EmailRequestedKey
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.distributor import IgnoreEmail
+from bridgedb.distributors.email import dkim
+from bridgedb.distributors.email import request
+from bridgedb.distributors.email import templates
+from bridgedb.distributors.email.distributor import EmailRequestedHelp
+from bridgedb.distributors.email.distributor import EmailRequestedKey
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.distributor import IgnoreEmail
 from bridgedb.parse import addr
 from bridgedb.parse.addr import canonicalizeEmailDomain
 from bridgedb.util import levenshteinDistance
@@ -69,7 +69,7 @@ def createResponseBody(lines, context, client, lang='en'):
 
     :param list lines: The list of lines from the original request sent by the
         client.
-    :type context: :class:`bridgedb.email.server.MailServerContext`
+    :type context: :class:`bridgedb.distributors.email.server.MailServerContext`
     :param context: The context which contains settings for the email server.
     :type client: :api:`twisted.mail.smtp.Address`
     :param client: The client's email address which should be in the
@@ -614,7 +614,7 @@ class SMTPAutoresponder(smtp.SMTPClient):
         3. Check that those canonical domains match.
 
         4. If the incoming message is from a domain which supports DKIM
-        signing, then run :func:`bridgedb.email.dkim.checkDKIM` as well.
+        signing, then run :func:`bridgedb.distributors.email.dkim.checkDKIM` as well.
 
         .. note:: Calling this method sets the
             :attr:`incoming.canonicalFromEmail` and
diff --git a/bridgedb/email/distributor.py b/bridgedb/distributors/email/distributor.py
similarity index 96%
rename from bridgedb/email/distributor.py
rename to bridgedb/distributors/email/distributor.py
index c6e45d5..06a0c50 100644
--- a/bridgedb/email/distributor.py
+++ b/bridgedb/distributors/email/distributor.py
@@ -11,10 +11,10 @@
 # :license: see LICENSE for licensing information
 
 """
-.. py:module:: bridgedb.email.distributor
+.. py:module:: bridgedb.distributors.email.distributor
     :synopsis: A Distributor which hands out Bridges via an email interface.
 
-bridgedb.email.autoresponder
+bridgedb.distributors.email.autoresponder
 ============================
 
 A :class:`~bridgedb.distribute.Distributor` which hands out :class:`bridges
@@ -117,11 +117,11 @@ class EmailDistributor(Distributor):
         .. hint:: All checks on the email address (which should be stored in
             the ``bridgeRequest.client`` attribute), such as checks for
             whitelisting and canonicalization of domain name, are done in
-            :meth:`bridgedb.email.autoresponder.getMailTo` and
-            :meth:`bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+            :meth:`bridgedb.distributors.email.autoresponder.getMailTo` and
+            :meth:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
 
         :type bridgeRequest:
-            :class:`~bridgedb.email.request.EmailBridgeRequest`
+            :class:`~bridgedb.distributors.email.request.EmailBridgeRequest`
         :param bridgeRequest: A
             :class:`~bridgedb.bridgerequest.BridgeRequestBase` with the
             :data:`~bridgedb.bridgerequest.BridgeRequestBase.client` attribute
diff --git a/bridgedb/email/dkim.py b/bridgedb/distributors/email/dkim.py
similarity index 95%
rename from bridgedb/email/dkim.py
rename to bridgedb/distributors/email/dkim.py
index c851c5c..be33d59 100644
--- a/bridgedb/email/dkim.py
+++ b/bridgedb/distributors/email/dkim.py
@@ -13,18 +13,18 @@
 #_____________________________________________________________________________
 
 """
-.. py:module:: bridgedb.email.dkim
+.. py:module:: bridgedb.distributors.email.dkim
     :synopsis: Functions for checking DKIM verification results in email
                headers.
 
-bridgedb.email.dkim
+bridgedb.distributors.email.dkim
 ===================
 
 Functions for checking DKIM verification results in email headers.
 
 ::
 
- bridgedb.email.dkim
+ bridgedb.distributors.email.dkim
   |_ checkDKIM - Check the DKIM verification results header.
 
 ..
diff --git a/bridgedb/email/request.py b/bridgedb/distributors/email/request.py
similarity index 94%
rename from bridgedb/email/request.py
rename to bridgedb/distributors/email/request.py
index 71167c7..a490e56 100644
--- a/bridgedb/email/request.py
+++ b/bridgedb/distributors/email/request.py
@@ -13,11 +13,11 @@
 #_____________________________________________________________________________
 
 """
-.. py:module:: bridgedb.email.request
+.. py:module:: bridgedb.distributors.email.request
     :synopsis: Classes for parsing and storing information about requests for
                bridges which are sent to the email distributor.
 
-bridgedb.email.request
+bridgedb.distributors.email.request
 ======================
 
 Classes for parsing and storing information about requests for bridges
@@ -28,7 +28,7 @@ which are sent to the email distributor.
 
 ::
 
-  bridgedb.email.request
+  bridgedb.distributors.email.request
    | |_ determineBridgeRequestOptions - Figure out which filters to apply, or
    |                                    offer help.
    |_ EmailBridgeRequest - A request for bridges which was received through
@@ -44,8 +44,8 @@ import logging
 import re
 
 from bridgedb import bridgerequest
-from bridgedb.email.distributor import EmailRequestedHelp
-from bridgedb.email.distributor import EmailRequestedKey
+from bridgedb.distributors.email.distributor import EmailRequestedHelp
+from bridgedb.distributors.email.distributor import EmailRequestedKey
 
 
 #: A regular expression for matching the Pluggable Transport method TYPE in
@@ -109,7 +109,7 @@ class EmailBridgeRequest(bridgerequest.BridgeRequestBase):
 
     def __init__(self):
         """Process a new bridge request received through the
-        :class:`~bridgedb.email.distributor.EmailDistributor`.
+        :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
         """
         super(EmailBridgeRequest, self).__init__()
         self._wantsKey = False
diff --git a/bridgedb/email/server.py b/bridgedb/distributors/email/server.py
similarity index 95%
rename from bridgedb/email/server.py
rename to bridgedb/distributors/email/server.py
index 41862e7..229f118 100644
--- a/bridgedb/email/server.py
+++ b/bridgedb/distributors/email/server.py
@@ -14,11 +14,11 @@
 
 
 """
-.. py:module:: bridgedb.email.server
+.. py:module:: bridgedb.distributors.email.server
     :synopsis: Servers which interface with clients and distribute bridges
                over SMTP.
 
-bridgedb.email.server
+bridgedb.distributors.email.server
 =====================
 
 Servers which interface with clients and distribute bridges over SMTP.
@@ -28,7 +28,7 @@ Servers which interface with clients and distribute bridges over SMTP.
 
 ::
 
-  bridgedb.email.server
+  bridgedb.distributors.email.server
    | |_ addServer - Set up a SMTP server which listens on the configured
    |                EMAIL_PORT for incoming connections, and responds as
    |                necessary to requests for bridges.
@@ -66,9 +66,9 @@ from zope.interface import implements
 from bridgedb import __version__
 from bridgedb import safelog
 from bridgedb.crypto import initializeGnuPG
-from bridgedb.email import autoresponder
-from bridgedb.email import templates
-from bridgedb.email import request
+from bridgedb.distributors.email import autoresponder
+from bridgedb.distributors.email import templates
+from bridgedb.distributors.email import request
 from bridgedb.parse import addr
 from bridgedb.parse.addr import UnsupportedDomain
 from bridgedb.parse.addr import canonicalizeEmailDomain
@@ -109,7 +109,7 @@ class MailServerContext(object):
         """Create a context for storing configs for email bridge distribution.
 
         :type config: :class:`bridgedb.persistent.Conf`
-        :type distributor: :class:`~bridgedb.email.distributor.EmailDistributor`
+        :type distributor: :class:`~bridgedb.distributors.email.distributor.EmailDistributor`
         :param distributor: The distributor will handle getting the correct
             bridges (or none) for a client for us.
         :type schedule: :class:`bridgedb.schedule.ScheduledInterval`
@@ -172,18 +172,18 @@ class SMTPMessage(object):
     :var bool ignoring: If ``True``, we're ignoring the rest of this message
         because it exceeded :data:`MailServerContext.maximumSize`.
     :var canonicalFromSMTP: See
-        :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+        :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
     :var canonicalFromEmail: See
-        :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+        :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
     :var canonicalDomainRules: See
-        :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.runChecks`.
+        :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.runChecks`.
     :var message: (:api:`twisted.mail.smtp.rfc822.Message` or ``None``) The
         incoming email message.
-    :var responder: A :class:`~bridgedb.email.autoresponder.SMTPAutoresponder`
+    :var responder: A :class:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder`
         which parses and checks the incoming :data:`message`. If it decides to
         do so, it will build a
-        :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.reply` email
-        and :meth:`~bridgedb.email.autoresponder.SMTPAutoresponder.send` it.
+        :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.reply` email
+        and :meth:`~bridgedb.distributors.email.autoresponder.SMTPAutoresponder.send` it.
     """
     implements(smtp.IMessage)
 
@@ -432,7 +432,7 @@ class SMTPIncomingServerFactory(smtp.SMTPFactory):
     automation whenever we get a incoming connection on the SMTP port.
 
     .. warning::
-        My :attr:`~bridgedb.email.server.SMTPIncomingServerFactory.context`
+        My :attr:`~bridgedb.distributors.email.server.SMTPIncomingServerFactory.context`
         isn't an OpenSSL context, as is used for the
         :api:`twisted.mail.smtp.ESMTPSender`.
 
@@ -477,7 +477,7 @@ def addServer(config, distributor):
 
     :type config: :class:`bridgedb.configure.Conf`
     :param config: A configuration object.
-    :type distributor: :class:`bridgedb.email.distributor.EmailDistributor`
+    :type distributor: :class:`bridgedb.distributors.email.distributor.EmailDistributor`
     :param dist: A distributor which will handle database interactions, and
         will decide which bridges to give to who and when.
     """
diff --git a/bridgedb/email/templates.py b/bridgedb/distributors/email/templates.py
similarity index 97%
rename from bridgedb/email/templates.py
rename to bridgedb/distributors/email/templates.py
index 014881e..85dd105 100644
--- a/bridgedb/email/templates.py
+++ b/bridgedb/distributors/email/templates.py
@@ -11,11 +11,11 @@
 #_____________________________________________________________________________
 
 """
-.. py:module:: bridgedb.email.templates
+.. py:module:: bridgedb.distributors.email.templates
     :synopsis: Templates for formatting emails sent out by the email
                distributor.
 
-bridgedb.email.templates
+bridgedb.distributors.email.templates
 ========================
 
 Templates for formatting emails sent out by the email distributor.
@@ -30,7 +30,7 @@ import os
 from datetime import datetime
 
 from bridgedb import strings
-from bridgedb.email.distributor import MAX_EMAIL_RATE
+from bridgedb.distributors.email.distributor import MAX_EMAIL_RATE
 
 
 def addCommands(template):
diff --git a/bridgedb/https/__init__.py b/bridgedb/distributors/https/__init__.py
similarity index 52%
rename from bridgedb/https/__init__.py
rename to bridgedb/distributors/https/__init__.py
index f1210ec..6c51a5f 100644
--- a/bridgedb/https/__init__.py
+++ b/bridgedb/distributors/https/__init__.py
@@ -1 +1,5 @@
 """Servers for BridgeDB's HTTPS bridge distributor."""
+
+import distributor
+import request
+import server
diff --git a/bridgedb/https/distributor.py b/bridgedb/distributors/https/distributor.py
similarity index 98%
rename from bridgedb/https/distributor.py
rename to bridgedb/distributors/https/distributor.py
index 4e980b7..791229b 100644
--- a/bridgedb/https/distributor.py
+++ b/bridgedb/distributors/https/distributor.py
@@ -11,7 +11,7 @@
 # :license: see LICENSE for licensing information
 
 """
-bridgedb.https.distributor
+bridgedb.distributors.https.distributor
 ==========================
 
 A Distributor that hands out bridges through a web interface.
@@ -119,7 +119,7 @@ class HTTPSDistributor(Distributor):
         ``1.2.178.234``) are placed within the same cluster, but Carol (with
         address ``1.3.11.33``) *might* end up in a different cluster.
 
-        >>> from bridgedb.https.distributor import HTTPSDistributor
+        >>> from bridgedb.distributors.https.distributor import HTTPSDistributor
         >>> HTTPSDistributor.getSubnet('1.2.3.4')
         '1.2.0.0/16'
         >>> HTTPSDistributor.getSubnet('1.2.211.154')
@@ -274,7 +274,7 @@ class HTTPSDistributor(Distributor):
     def getBridges(self, bridgeRequest, interval):
         """Return a list of bridges to give to a user.
 
-        :type bridgeRequest: :class:`bridgedb.https.request.HTTPSBridgeRequest`
+        :type bridgeRequest: :class:`bridgedb.distributors.https.request.HTTPSBridgeRequest`
         :param bridgeRequest: A :class:`~bridgedb.bridgerequest.BridgeRequestBase`
             with the :data:`~bridgedb.bridgerequest.BridgeRequestBase.client`
             attribute set to a string containing the client's IP address.
@@ -283,7 +283,7 @@ class HTTPSDistributor(Distributor):
         :rtype: list
         :return: A list of :class:`~bridgedb.Bridges.Bridge`s to include in
             the response. See
-            :meth:`bridgedb.https.server.WebResourceBridges.getBridgeRequestAnswer`
+            :meth:`bridgedb.distributors.https.server.WebResourceBridges.getBridgeRequestAnswer`
             for an example of how this is used.
         """
         logging.info("Attempting to get bridges for %s..." % bridgeRequest.client)
diff --git a/bridgedb/https/request.py b/bridgedb/distributors/https/request.py
similarity index 96%
rename from bridgedb/https/request.py
rename to bridgedb/distributors/https/request.py
index fd80809..3236bee 100644
--- a/bridgedb/https/request.py
+++ b/bridgedb/distributors/https/request.py
@@ -10,11 +10,11 @@
 #_____________________________________________________________________________
 
 """
-.. py:module:: bridgedb.https.request
+.. py:module:: bridgedb.distributors.https.request
     :synopsis: Classes for parsing and storing information about requests for
                bridges which are sent to the HTTPS distributor.
 
-bridgedb.https.request
+bridgedb.distributors.https.request
 ======================
 
 Classes for parsing and storing information about requests for bridges
@@ -24,7 +24,7 @@ which are sent to the HTTPS distributor.
 
 ::
 
-  bridgedb.https.request
+  bridgedb.distributors.https.request
    |
    |_ HTTPSBridgeRequest - A request for bridges which was received through
                            the HTTPS distributor.
@@ -58,7 +58,7 @@ class HTTPSBridgeRequest(bridgerequest.BridgeRequestBase):
 
     def __init__(self, addClientCountryCode=True):
         """Process a new bridge request received through the
-        :class:`~bridgedb.https.distributor.HTTPSDistributor`.
+        :class:`~bridgedb.distributors.https.distributor.HTTPSDistributor`.
 
         :param bool addClientCountryCode: If ``True``, then calling
             :meth:`withoutBlockInCountry` will attempt to add the client's own
diff --git a/bridgedb/https/server.py b/bridgedb/distributors/https/server.py
similarity index 99%
rename from bridgedb/https/server.py
rename to bridgedb/distributors/https/server.py
index c785450..3e4284f 100644
--- a/bridgedb/https/server.py
+++ b/bridgedb/distributors/https/server.py
@@ -8,11 +8,11 @@
 # :license: see LICENSE for licensing information
 
 """
-.. py:module:: bridgedb.https.server
+.. py:module:: bridgedb.distributors.https.server
     :synopsis: Servers which interface with clients and distribute bridges
                over HTTP(S).
 
-bridgedb.https.server
+bridgedb.distributors.https.server
 =====================
 
 Servers which interface with clients and distribute bridges over HTTP(S).
@@ -50,7 +50,7 @@ from bridgedb import crypto
 from bridgedb import strings
 from bridgedb import translations
 from bridgedb import txrecaptcha
-from bridgedb.https.request import HTTPSBridgeRequest
+from bridgedb.distributors.https.request import HTTPSBridgeRequest
 from bridgedb.parse import headers
 from bridgedb.parse.addr import isIPAddress
 from bridgedb.qrcodes import generateQR
@@ -1032,7 +1032,7 @@ def addWebServer(config, distributor):
              CSP_ENABLED
              CSP_REPORT_ONLY
              CSP_INCLUDE_SELF
-    :type distributor: :class:`bridgedb.https.distributor.HTTPSDistributor`
+    :type distributor: :class:`bridgedb.distributors.https.distributor.HTTPSDistributor`
     :param distributor: A bridge distributor.
     :raises SystemExit: if the servers cannot be started.
     :rtype: :api:`twisted.web.server.Site`
diff --git a/bridgedb/https/templates/assets/css/bootstrap.min.css b/bridgedb/distributors/https/templates/assets/css/bootstrap.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/bootstrap.min.css
rename to bridgedb/distributors/https/templates/assets/css/bootstrap.min.css
diff --git a/bridgedb/https/templates/assets/css/error.css b/bridgedb/distributors/https/templates/assets/css/error.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/error.css
rename to bridgedb/distributors/https/templates/assets/css/error.css
diff --git a/bridgedb/https/templates/assets/css/font-awesome-ie7.min.css b/bridgedb/distributors/https/templates/assets/css/font-awesome-ie7.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/font-awesome-ie7.min.css
rename to bridgedb/distributors/https/templates/assets/css/font-awesome-ie7.min.css
diff --git a/bridgedb/https/templates/assets/css/font-awesome.min.css b/bridgedb/distributors/https/templates/assets/css/font-awesome.min.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/font-awesome.min.css
rename to bridgedb/distributors/https/templates/assets/css/font-awesome.min.css
diff --git a/bridgedb/https/templates/assets/css/main.css b/bridgedb/distributors/https/templates/assets/css/main.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/main.css
rename to bridgedb/distributors/https/templates/assets/css/main.css
diff --git a/bridgedb/https/templates/assets/css/rtl.css b/bridgedb/distributors/https/templates/assets/css/rtl.css
similarity index 100%
rename from bridgedb/https/templates/assets/css/rtl.css
rename to bridgedb/distributors/https/templates/assets/css/rtl.css
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.eot b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.eot
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.eot
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.eot
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.svg b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.svg
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.svg
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.svg
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.ttf b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.ttf
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.ttf
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.ttf
diff --git a/bridgedb/https/templates/assets/font/fontawesome-webfont.woff b/bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/fontawesome-webfont.woff
rename to bridgedb/distributors/https/templates/assets/font/fontawesome-webfont.woff
diff --git a/bridgedb/https/templates/assets/font/lato-bold.woff b/bridgedb/distributors/https/templates/assets/font/lato-bold.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-bold.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-bold.woff
diff --git a/bridgedb/https/templates/assets/font/lato-italic.woff b/bridgedb/distributors/https/templates/assets/font/lato-italic.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-italic.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-italic.woff
diff --git a/bridgedb/https/templates/assets/font/lato-regular.woff b/bridgedb/distributors/https/templates/assets/font/lato-regular.woff
similarity index 100%
rename from bridgedb/https/templates/assets/font/lato-regular.woff
rename to bridgedb/distributors/https/templates/assets/font/lato-regular.woff
diff --git a/bridgedb/https/templates/assets/images/404-excavator.svg b/bridgedb/distributors/https/templates/assets/images/404-excavator.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-excavator.svg
rename to bridgedb/distributors/https/templates/assets/images/404-excavator.svg
diff --git a/bridgedb/https/templates/assets/images/404-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/404-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/404-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/404-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/404-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/404-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/404-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-left-shade.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-left-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-left-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-left-shade.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-right-shade.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-right-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-right-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-right-shade.svg
diff --git a/bridgedb/https/templates/assets/images/500-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/500-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/500-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/500-road.svg b/bridgedb/distributors/https/templates/assets/images/500-road.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/500-road.svg
rename to bridgedb/distributors/https/templates/assets/images/500-road.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-left-shade.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-left-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-left-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-left-shade.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-left.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-left.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-left.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-left.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-right-shade.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-right-shade.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-right-shade.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-right-shade.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-hills-right.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-hills-right.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-hills-right.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-hills-right.svg
diff --git a/bridgedb/https/templates/assets/images/maintenance-tractor.svg b/bridgedb/distributors/https/templates/assets/images/maintenance-tractor.svg
similarity index 100%
rename from bridgedb/https/templates/assets/images/maintenance-tractor.svg
rename to bridgedb/distributors/https/templates/assets/images/maintenance-tractor.svg
diff --git a/bridgedb/https/templates/assets/js/bridges.js b/bridgedb/distributors/https/templates/assets/js/bridges.js
similarity index 100%
rename from bridgedb/https/templates/assets/js/bridges.js
rename to bridgedb/distributors/https/templates/assets/js/bridges.js
diff --git a/bridgedb/https/templates/assets/tor-roots-blue.svg b/bridgedb/distributors/https/templates/assets/tor-roots-blue.svg
similarity index 100%
rename from bridgedb/https/templates/assets/tor-roots-blue.svg
rename to bridgedb/distributors/https/templates/assets/tor-roots-blue.svg
diff --git a/bridgedb/https/templates/assets/tor.svg b/bridgedb/distributors/https/templates/assets/tor.svg
similarity index 100%
rename from bridgedb/https/templates/assets/tor.svg
rename to bridgedb/distributors/https/templates/assets/tor.svg
diff --git a/bridgedb/https/templates/base.html b/bridgedb/distributors/https/templates/base.html
similarity index 100%
rename from bridgedb/https/templates/base.html
rename to bridgedb/distributors/https/templates/base.html
diff --git a/bridgedb/https/templates/bridges.html b/bridgedb/distributors/https/templates/bridges.html
similarity index 100%
rename from bridgedb/https/templates/bridges.html
rename to bridgedb/distributors/https/templates/bridges.html
diff --git a/bridgedb/https/templates/captcha.html b/bridgedb/distributors/https/templates/captcha.html
similarity index 100%
rename from bridgedb/https/templates/captcha.html
rename to bridgedb/distributors/https/templates/captcha.html
diff --git a/bridgedb/https/templates/error-404.html b/bridgedb/distributors/https/templates/error-404.html
similarity index 100%
rename from bridgedb/https/templates/error-404.html
rename to bridgedb/distributors/https/templates/error-404.html
diff --git a/bridgedb/https/templates/error-500.html b/bridgedb/distributors/https/templates/error-500.html
similarity index 100%
rename from bridgedb/https/templates/error-500.html
rename to bridgedb/distributors/https/templates/error-500.html
diff --git a/bridgedb/https/templates/error-503.html b/bridgedb/distributors/https/templates/error-503.html
similarity index 100%
rename from bridgedb/https/templates/error-503.html
rename to bridgedb/distributors/https/templates/error-503.html
diff --git a/bridgedb/https/templates/howto.html b/bridgedb/distributors/https/templates/howto.html
similarity index 100%
rename from bridgedb/https/templates/howto.html
rename to bridgedb/distributors/https/templates/howto.html
diff --git a/bridgedb/https/templates/index.html b/bridgedb/distributors/https/templates/index.html
similarity index 100%
rename from bridgedb/https/templates/index.html
rename to bridgedb/distributors/https/templates/index.html
diff --git a/bridgedb/https/templates/options.html b/bridgedb/distributors/https/templates/options.html
similarity index 100%
rename from bridgedb/https/templates/options.html
rename to bridgedb/distributors/https/templates/options.html
diff --git a/bridgedb/https/templates/robots.txt b/bridgedb/distributors/https/templates/robots.txt
similarity index 100%
rename from bridgedb/https/templates/robots.txt
rename to bridgedb/distributors/https/templates/robots.txt
diff --git a/bridgedb/email/__init__.py b/bridgedb/email/__init__.py
deleted file mode 100644
index 604c648..0000000
--- a/bridgedb/email/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Servers for BridgeDB's email bridge distributor."""
diff --git a/bridgedb/parse/addr.py b/bridgedb/parse/addr.py
index cd512d1..bf5a8a5 100644
--- a/bridgedb/parse/addr.py
+++ b/bridgedb/parse/addr.py
@@ -217,7 +217,7 @@ def canonicalizeEmailDomain(domain, domainmap):
     :param str domain: The domain portion of an email address to validate. It
         will be checked that it is one of the domains allowed to email
         requests for bridges to the
-        :class:`~bridgedb.email.distributor.EmailDistributor`.
+        :class:`~bridgedb.distributors.email.distributor.EmailDistributor`.
     :param dict domainmap: A map of permitted alternate domains (in lowercase)
         to their canonical domain names (in lowercase). This can be configured
         with the ``EMAIL_DOMAIN_MAP`` option in ``bridgedb.conf``, for
@@ -442,7 +442,7 @@ def normalizeEmail(emailaddr, domainmap, domainrules, ignorePlus=True):
     The email address, **emailaddr**, will be parsed and validated, and then
     checked that it originated from one of the domains allowed to email
     requests for bridges to the
-    :class:`~bridgedb.email.distributor.EmailDistributor` via the
+    :class:`~bridgedb.distributors.email.distributor.EmailDistributor` via the
     :func:`canonicaliseEmailDomain` function.
 
     :param str emailaddr: An email address to normalise.
diff --git a/bridgedb/persistent.py b/bridgedb/persistent.py
index 4410b9b..c46c4a5 100644
--- a/bridgedb/persistent.py
+++ b/bridgedb/persistent.py
@@ -25,8 +25,8 @@ from twisted.spread import jelly
 
 from bridgedb import Bridges
 from bridgedb import filters
-from bridgedb.email import distributor as emailDistributor
-from bridgedb.https import distributor as httpsDistributor
+from bridgedb.distributors.email import distributor as emailDistributor
+from bridgedb.distributors.https import distributor as httpsDistributor
 from bridgedb.configure import Conf
 #from bridgedb.proxy import ProxySet
 
diff --git a/bridgedb/strings.py b/bridgedb/strings.py
index 7d4b99e..1c40695 100644
--- a/bridgedb/strings.py
+++ b/bridgedb/strings.py
@@ -92,7 +92,7 @@ help to circumvent internet censorship in many cases.\n\n"""),
 }
 """These strings should go on the first "Welcome" email sent by the
 :mod:`~bridgedb.EmailServer`, as well as on the ``index.html`` template used
-by the :mod:`~bridgedb.https.server`. They are used as an introduction to
+by the :mod:`~bridgedb.distributors.https.server`. They are used as an introduction to
 explain what Tor bridges are, what bridges do, and why someone might want to
 use bridges.
 """
@@ -278,7 +278,7 @@ contain format specifiers (i.e. ``%s``) to what those format specifiers should
 be replaced with in a given template system.
 
 For example, a string which needs a pair of HTML ``("<a href=''">, "</a>")``
-tags (for the templates used by :mod:`bridgedb.https.server`) would need some
+tags (for the templates used by :mod:`bridgedb.distributors.https.server`) would need some
 alternative replacements for the :mod:`EmailServer`, because the latter uses
 templates with a ``text/plain`` mimetype instead of HTML. For the
 ``EmailServer``, the format strings specifiers are replaced with an empty
diff --git a/bridgedb/test/email_helpers.py b/bridgedb/test/email_helpers.py
index 55b8033..645fc93 100644
--- a/bridgedb/test/email_helpers.py
+++ b/bridgedb/test/email_helpers.py
@@ -14,9 +14,9 @@
 import io
 
 from bridgedb.persistent import Conf
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.server import MailServerContext
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.server import MailServerContext
 from bridgedb.schedule import Unscheduled
 
 from . import util
@@ -121,7 +121,7 @@ def _createMailServerContext(config=None, distributor=None):
 
 
 class DummyEmailDistributor(object):
-    """A mocked :class:`bridgedb.email.distributor.EmailDistributor` which is used
+    """A mocked :class:`bridgedb.distributors.email.distributor.EmailDistributor` which is used
     to test :class:`bridgedb.EmailServer`.
     """
 
@@ -145,9 +145,9 @@ class DummyEmailDistributor(object):
 
 
 class DummyEmailDistributorWithState(DummyEmailDistributor):
-    """A mocked :class:`bridgedb.email.distributor.EmailDistributor` which raises
-    :exc:`bridgedb.email.distributor.TooSoonEmail` on the second email and
-    :exc:`bridgedb.email.distributor.IgnoreEmail` on the third.
+    """A mocked :class:`bridgedb.distributors.email.distributor.EmailDistributor` which raises
+    :exc:`bridgedb.distributors.email.distributor.TooSoonEmail` on the second email and
+    :exc:`bridgedb.distributors.email.distributor.IgnoreEmail` on the third.
 
     Note that the state tracking is done in a really dumb way. For example, we
     currently don't consider requests for help text or GnuPG keys to be a
diff --git a/bridgedb/test/https_helpers.py b/bridgedb/test/https_helpers.py
index 5c1c838..d54e544 100644
--- a/bridgedb/test/https_helpers.py
+++ b/bridgedb/test/https_helpers.py
@@ -113,8 +113,8 @@ def _createConfig(configFile=TEST_CONFIG_FILE):
 
 
 class DummyHTTPSDistributor(object):
-    """A mocked :class:`bridgedb.https.distributor.HTTPSDistributor` which is
-    used to test :class:`bridgedb.https.server.BridgesResource`.
+    """A mocked :class:`bridgedb.distributors.https.distributor.HTTPSDistributor` which is
+    used to test :class:`bridgedb.distributors.https.server.BridgesResource`.
     """
     _bridge_class = util.DummyBridge
     _bridgesPerResponseMin = 3
diff --git a/bridgedb/test/legacy_Tests.py b/bridgedb/test/legacy_Tests.py
index 22b2e13..77409b4 100644
--- a/bridgedb/test/legacy_Tests.py
+++ b/bridgedb/test/legacy_Tests.py
@@ -26,9 +26,9 @@ import ipaddr
 
 from bridgedb.Stability import BridgeHistory
 
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
 from bridgedb.parse import addr
 
 from .util import bracketIPv6
diff --git a/bridgedb/test/test_email_autoresponder.py b/bridgedb/test/test_email_autoresponder.py
index 6bdac9e..a1e376f 100644
--- a/bridgedb/test/test_email_autoresponder.py
+++ b/bridgedb/test/test_email_autoresponder.py
@@ -9,7 +9,7 @@
 #             (c) 2007-2013, all entities within the AUTHORS file
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
-"""Unittests for the :mod:`bridgedb.email.autoresponder` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.autoresponder` module."""
 
 from __future__ import print_function
 
@@ -23,9 +23,9 @@ from twisted.python.failure import Failure
 from twisted.trial import unittest
 from twisted.test import proto_helpers
 
-from bridgedb.email import autoresponder
-from bridgedb.email.server import SMTPMessage
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email import autoresponder
+from bridgedb.distributors.email.server import SMTPMessage
+from bridgedb.distributors.email.distributor import TooSoonEmail
 
 from bridgedb.test.email_helpers import _createConfig
 from bridgedb.test.email_helpers import _createMailServerContext
@@ -33,7 +33,7 @@ from bridgedb.test.email_helpers import DummyEmailDistributorWithState
 
 
 class CreateResponseBodyTests(unittest.TestCase):
-    """Tests for :func:`bridgedb.email.autoresponder.createResponseBody`."""
+    """Tests for :func:`bridgedb.distributors.email.autoresponder.createResponseBody`."""
 
     def _moveGPGTestKeyfile(self):
         here          = os.getcwd()
@@ -289,7 +289,7 @@ a ball of timey-wimey, wibbly-warbly... stuff."""
 
 
 class SMTPAutoresponderTests(unittest.TestCase):
-    """Unittests for :class:`bridgedb.email.autoresponder.SMTPAutoresponder`."""
+    """Unittests for :class:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder`."""
 
     timeout = 10
 
@@ -322,7 +322,7 @@ class SMTPAutoresponderTests(unittest.TestCase):
         self.responder = self.message.responder
         # The following are needed to provide client disconnection methods for
         # the call to ``twisted.mail.smtp.SMTPClient.sendError`` in
-        # ``bridgedb.email.autoresponder.SMTPAutoresponder.sendError``:
+        # ``bridgedb.distributors.email.autoresponder.SMTPAutoresponder.sendError``:
         #protocol = proto_helpers.AccumulatingProtocol()
         #transport = proto_helpers.StringTransportWithDisconnection()
         self.tr = proto_helpers.StringTransportWithDisconnection()
diff --git a/bridgedb/test/test_email_distributor.py b/bridgedb/test/test_email_distributor.py
index 0d727b8..d95370f 100644
--- a/bridgedb/test/test_email_distributor.py
+++ b/bridgedb/test/test_email_distributor.py
@@ -7,7 +7,7 @@
 #             (c) 2007-2017, The Tor Project, Inc.
 # :license: see included LICENSE for information
 
-"""Tests for :mod:`bridgedb.email.distributor`."""
+"""Tests for :mod:`bridgedb.distributors.email.distributor`."""
 
 from __future__ import print_function
 
@@ -21,10 +21,10 @@ from twisted.trial import unittest
 import bridgedb.Storage
 
 from bridgedb.bridges import Bridge
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import IgnoreEmail
-from bridgedb.email.distributor import TooSoonEmail
-from bridgedb.email.request import EmailBridgeRequest
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import IgnoreEmail
+from bridgedb.distributors.email.distributor import TooSoonEmail
+from bridgedb.distributors.email.request import EmailBridgeRequest
 from bridgedb.parse.addr import BadEmail
 from bridgedb.parse.addr import UnsupportedDomain
 from bridgedb.parse.addr import normalizeEmail
@@ -38,7 +38,7 @@ BRIDGES = generateFakeBridges()
 
 
 class EmailDistributorTests(unittest.TestCase):
-    """Tests for :class:`bridgedb.email.distributor.EmailDistributor`."""
+    """Tests for :class:`bridgedb.distributors.email.distributor.EmailDistributor`."""
 
     # Fail any tests which take longer than 15 seconds.
     timeout = 15
diff --git a/bridgedb/test/test_email_dkim.py b/bridgedb/test/test_email_dkim.py
index 499a3c1..dc4c53b 100644
--- a/bridgedb/test/test_email_dkim.py
+++ b/bridgedb/test/test_email_dkim.py
@@ -9,14 +9,14 @@
 #             (c) 2007-2013, all entities within the AUTHORS file
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
-"""Unittests for the :mod:`bridgedb.email.dkim` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.dkim` module."""
 
 import io
 
 from twisted.mail.smtp import rfc822
 from twisted.trial import unittest
 
-from bridgedb.email import dkim
+from bridgedb.distributors.email import dkim
 
 
 class CheckDKIMTests(unittest.TestCase):
diff --git a/bridgedb/test/test_email_request.py b/bridgedb/test/test_email_request.py
index 745ea71..0c87d36 100644
--- a/bridgedb/test/test_email_request.py
+++ b/bridgedb/test/test_email_request.py
@@ -9,7 +9,7 @@
 #             (c) 2007-2013, all entities within the AUTHORS file
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
-"""Unittests for the :mod:`bridgedb.email.request` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.request` module."""
 
 from __future__ import print_function
 
@@ -17,7 +17,7 @@ import ipaddr
 
 from twisted.trial import unittest
 
-from bridgedb.email import request
+from bridgedb.distributors.email import request
 
 
 class DetermineBridgeRequestOptionsTests(unittest.TestCase):
diff --git a/bridgedb/test/test_email_server.py b/bridgedb/test/test_email_server.py
index 946133c..edf2539 100644
--- a/bridgedb/test/test_email_server.py
+++ b/bridgedb/test/test_email_server.py
@@ -9,7 +9,7 @@
 #             (c) 2007-2013, all entities within the AUTHORS file
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
-"""Unittests for the :mod:`bridgedb.email.server` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.server` module."""
 
 from __future__ import print_function
 
@@ -31,9 +31,9 @@ from twisted.trial import unittest
 
 from zope.interface import implementedBy
 
-from bridgedb.email import server
-from bridgedb.email.distributor import EmailDistributor
-from bridgedb.email.distributor import TooSoonEmail
+from bridgedb.distributors.email import server
+from bridgedb.distributors.email.distributor import EmailDistributor
+from bridgedb.distributors.email.distributor import TooSoonEmail
 from bridgedb.parse.addr import BadEmail
 from bridgedb.schedule import Unscheduled
 
@@ -43,7 +43,7 @@ from bridgedb.test.email_helpers import _createMailServerContext
 
 
 class SMTPMessageTests(unittest.TestCase):
-    """Unittests for :class:`bridgedb.email.server.SMTPMessage`."""
+    """Unittests for :class:`bridgedb.distributors.email.server.SMTPMessage`."""
 
     def setUp(self):
         self.config = _createConfig()
@@ -59,7 +59,7 @@ class SMTPMessageTests(unittest.TestCase):
     def test_SMTPMessage_init(self):
         """Our ``message`` attribute should be a ``SMTPMessage`` object, and
         ``message.responder`` should be a
-        :class:`bridgedb.email.autoresponder.SMTPAutoresponder`.
+        :class:`bridgedb.distributors.email.autoresponder.SMTPAutoresponder`.
         """
         self.assertIsInstance(self.message, server.SMTPMessage)
         self.assertIsInstance(self.message.responder,
@@ -320,7 +320,7 @@ class SMTPTestCaseMixin(util.TestCaseMixin):
          segment. Includes the SMTP DATA EOM command ('.') at the end. If no
          keyword arguments are given, the defaults are fairly sane.
 
-        Suitable for testing a :class:`bridgedb.email.server.SMTPIncomingServerFactory`.
+        Suitable for testing a :class:`bridgedb.distributors.email.server.SMTPIncomingServerFactory`.
 
         :param str fromAddr: An email address for the 'From:' header.
         :param str toAddr: An email address for the 'To:' header.
@@ -382,7 +382,7 @@ class SMTPTestCaseMixin(util.TestCaseMixin):
 
 
 class SMTPIncomingServerFactoryTests(SMTPTestCaseMixin, unittest.TestCase):
-    """Unittests for :class:`bridgedb.email.server.SMTPIncomingServerFactory`."""
+    """Unittests for :class:`bridgedb.distributors.email.server.SMTPIncomingServerFactory`."""
 
     def setUp(self):
         """Set up a localhost SMTPIncomingServerFactory handler incoming SMTP
@@ -502,7 +502,7 @@ class SMTPIncomingServerFactoryTests(SMTPTestCaseMixin, unittest.TestCase):
 
 
 class EmailServerServiceTests(SMTPTestCaseMixin, unittest.TestCase):
-    """Unittests for :func:`bridgedb.email.server.addServer`."""
+    """Unittests for :func:`bridgedb.distributors.email.server.addServer`."""
 
     def setUp(self):
         """Create a MailServerContext and EmailDistributor."""
@@ -523,7 +523,7 @@ class EmailServerServiceTests(SMTPTestCaseMixin, unittest.TestCase):
         reactor.runUntilCurrent()
 
     def test_addServer(self):
-        """Call :func:`bridgedb.email.server.addServer` to test startup."""
+        """Call :func:`bridgedb.distributors.email.server.addServer` to test startup."""
         factory = server.addServer(self.config, self.dist)
         factory.timeout = None
         factory.protocol.timeout = None  # Or else the reactor gets dirty
diff --git a/bridgedb/test/test_email_templates.py b/bridgedb/test/test_email_templates.py
index 0c74377..8464fe9 100644
--- a/bridgedb/test/test_email_templates.py
+++ b/bridgedb/test/test_email_templates.py
@@ -9,7 +9,7 @@
 #             (c) 2007-2013, all entities within the AUTHORS file
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
-"""Unittests for the :mod:`bridgedb.email.templates` module."""
+"""Unittests for the :mod:`bridgedb.distributors.email.templates` module."""
 
 from __future__ import print_function
 from __future__ import unicode_literals
@@ -20,7 +20,7 @@ from gettext import NullTranslations
 from twisted.mail.smtp import Address
 from twisted.trial import unittest
 
-from bridgedb.email import templates
+from bridgedb.distributors.email import templates
 
 
 class EmailTemplatesTests(unittest.TestCase):
diff --git a/bridgedb/test/test_https_distributor.py b/bridgedb/test/test_https_distributor.py
index 0d20960..791a940 100644
--- a/bridgedb/test/test_https_distributor.py
+++ b/bridgedb/test/test_https_distributor.py
@@ -9,7 +9,7 @@
 #             (c) 2007-2017, all entities within the AUTHORS file
 # :license: 3-clause BSD, see included LICENSE for information
 
-"""Tests for :mod:`bridgedb.https.distributor`."""
+"""Tests for :mod:`bridgedb.distributors.https.distributor`."""
 
 from __future__ import print_function
 
@@ -23,8 +23,8 @@ from bridgedb.Bridges import BridgeRing
 from bridgedb.Bridges import BridgeRingParameters
 from bridgedb.filters import byIPv4
 from bridgedb.filters import byIPv6
-from bridgedb.https import distributor
-from bridgedb.https.request import HTTPSBridgeRequest
+from bridgedb.distributors.https import distributor
+from bridgedb.distributors.https.request import HTTPSBridgeRequest
 from bridgedb.proxy import ProxySet
 
 from bridgedb.test.util import randomValidIPv4String
diff --git a/bridgedb/test/test_https_request.py b/bridgedb/test/test_https_request.py
index c262aef..2ea3fe6 100644
--- a/bridgedb/test/test_https_request.py
+++ b/bridgedb/test/test_https_request.py
@@ -14,7 +14,7 @@
 from twisted.trial import unittest
 
 from bridgedb.bridgerequest import IRequestBridges
-from bridgedb.https import request 
+from bridgedb.distributors.https import request 
 
 
 class MockRequest(object):
@@ -23,7 +23,7 @@ class MockRequest(object):
 
 
 class HTTPSBridgeRequestTests(unittest.TestCase):
-    """Unittests for :class:`bridgedb.https.request.HTTPSBridgeRequest`."""
+    """Unittests for :class:`bridgedb.distributors.https.request.HTTPSBridgeRequest`."""
 
     def setUp(self):
         """Setup test run."""
diff --git a/bridgedb/test/test_https_server.py b/bridgedb/test/test_https_server.py
index 3827bfe..2c41359 100644
--- a/bridgedb/test/test_https_server.py
+++ b/bridgedb/test/test_https_server.py
@@ -9,7 +9,7 @@
 # :license: see LICENSE for licensing information
 #_____________________________________________________________________________
 
-"""Unittests for :mod:`bridgedb.https.server`."""
+"""Unittests for :mod:`bridgedb.distributors.https.server`."""
 
 from __future__ import print_function
 
@@ -27,7 +27,7 @@ from twisted.trial import unittest
 from twisted.web.resource import Resource
 from twisted.web.test import requesthelper
 
-from bridgedb.https import server
+from bridgedb.distributors.https import server
 from bridgedb.schedule import ScheduledInterval
 
 from bridgedb.test.https_helpers import _createConfig
@@ -44,8 +44,8 @@ logging.disable(50)
 
 
 class SetFQDNTests(unittest.TestCase):
-    """Tests for :func:`bridgedb.https.server.setFQDN` and
-    :func:`bridgedb.https.server.setFQDN`.
+    """Tests for :func:`bridgedb.distributors.https.server.setFQDN` and
+    :func:`bridgedb.distributors.https.server.setFQDN`.
     """
 
     def setUp(self):
@@ -72,7 +72,7 @@ class SetFQDNTests(unittest.TestCase):
 
 
 class GetClientIPTests(unittest.TestCase):
-    """Tests for :func:`bridgedb.https.server.getClientIP`."""
+    """Tests for :func:`bridgedb.distributors.https.server.getClientIP`."""
 
     def createRequestWithIPs(self):
         """Set the IP address returned from ``request.getClientIP()`` to
@@ -114,7 +114,7 @@ class GetClientIPTests(unittest.TestCase):
 
 
 class ReplaceErrorPageTests(unittest.TestCase):
-    """Tests for :func:`bridgedb.https.server.replaceErrorPage`."""
+    """Tests for :func:`bridgedb.distributors.https.server.replaceErrorPage`."""
 
     def setUp(self):
         self.resource500 = server.resource500
@@ -152,7 +152,7 @@ class ReplaceErrorPageTests(unittest.TestCase):
                              errorPage)
 
 class ErrorResourceTests(unittest.TestCase):
-    """Tests for :class:`bridgedb.https.server.ErrorResource`."""
+    """Tests for :class:`bridgedb.distributors.https.server.ErrorResource`."""
 
     def setUp(self):
         self.request = DummyRequest([''])
@@ -174,7 +174,7 @@ class ErrorResourceTests(unittest.TestCase):
 
 
 class CustomErrorHandlingResourceTests(unittest.TestCase):
-    """Tests for :class:`bridgedb.https.server.CustomErrorHandlingResource`."""
+    """Tests for :class:`bridgedb.distributors.https.server.CustomErrorHandlingResource`."""
 
     def test_getChild(self):
         """``CustomErrorHandlingResource.getChild`` should return a rendered
@@ -258,7 +258,7 @@ class CSPResourceTests(unittest.TestCase):
 
 
 class IndexResourceTests(unittest.TestCase):
-    """Test for :class:`bridgedb.https.server.IndexResource`."""
+    """Test for :class:`bridgedb.distributors.https.server.IndexResource`."""
 
     def setUp(self):
         self.pagename = ''
@@ -283,7 +283,7 @@ class IndexResourceTests(unittest.TestCase):
 
 
 class HowtoResourceTests(unittest.TestCase):
-    """Test for :class:`bridgedb.https.server.HowtoResource`."""
+    """Test for :class:`bridgedb.distributors.https.server.HowtoResource`."""
 
     def setUp(self):
         self.pagename = 'howto.html'
@@ -308,7 +308,7 @@ class HowtoResourceTests(unittest.TestCase):
 
 
 class CaptchaProtectedResourceTests(unittest.TestCase):
-    """Tests for :class:`bridgedb.https.server.CaptchaProtectedResource`."""
+    """Tests for :class:`bridgedb.distributors.https.server.CaptchaProtectedResource`."""
 
     def setUp(self):
         self.dist = None
@@ -391,7 +391,7 @@ class CaptchaProtectedResourceTests(unittest.TestCase):
 
 
 class GimpCaptchaProtectedResourceTests(unittest.TestCase):
-    """Tests for :mod:`bridgedb.https.server.GimpCaptchaProtectedResource`."""
+    """Tests for :mod:`bridgedb.distributors.https.server.GimpCaptchaProtectedResource`."""
 
     def setUp(self):
         """Create a :class:`server.BridgesResource` and protect it with
@@ -518,7 +518,7 @@ class GimpCaptchaProtectedResourceTests(unittest.TestCase):
 
 
 class ReCaptchaProtectedResourceTests(unittest.TestCase):
-    """Tests for :mod:`bridgedb.https.server.ReCaptchaProtectedResource`."""
+    """Tests for :mod:`bridgedb.distributors.https.server.ReCaptchaProtectedResource`."""
 
     def setUp(self):
         """Create a :class:`server.BridgesResource` and protect it with
@@ -947,7 +947,7 @@ class BridgesResourceTests(unittest.TestCase):
 
 
 class OptionsResourceTests(unittest.TestCase):
-    """Tests for :class:`bridgedb.https.server.OptionsResource`."""
+    """Tests for :class:`bridgedb.distributors.https.server.OptionsResource`."""
 
     def setUp(self):
         """Create a :class:`server.OptionsResource`."""
@@ -973,7 +973,7 @@ class OptionsResourceTests(unittest.TestCase):
 
 
 class HTTPSServerServiceTests(unittest.TestCase):
-    """Unittests for :func:`bridgedb.email.server.addWebServer`."""
+    """Unittests for :func:`bridgedb.distributors.email.server.addWebServer`."""
 
     def setUp(self):
         """Create a config and an HTTPSDistributor."""
@@ -998,29 +998,29 @@ class HTTPSServerServiceTests(unittest.TestCase):
         reactor.runUntilCurrent()
 
     def test_addWebServer_GIMP_CAPTCHA_ENABLED(self):
-        """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
         server.addWebServer(self.config, self.distributor)
 
     def test_addWebServer_RECAPTCHA_ENABLED(self):
-        """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
         config = self.config
         config.RECAPTCHA_ENABLED = True
         server.addWebServer(config, self.distributor)
 
     def test_addWebServer_no_captchas(self):
-        """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
         config = self.config
         config.GIMP_CAPTCHA_ENABLED = False
         server.addWebServer(config, self.distributor)
 
     def test_addWebServer_no_HTTPS_ROTATION_PERIOD(self):
-        """Call :func:`bridgedb.https.server.addWebServer` to test startup."""
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` to test startup."""
         config = self.config
         config.HTTPS_ROTATION_PERIOD = None
         server.addWebServer(config, self.distributor)
 
     def test_addWebServer_CSP_ENABLED_False(self):
-        """Call :func:`bridgedb.https.server.addWebServer` with
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` with
         ``CSP_ENABLED=False`` to test startup.
         """
         config = self.config
@@ -1028,7 +1028,7 @@ class HTTPSServerServiceTests(unittest.TestCase):
         server.addWebServer(config, self.distributor)
 
     def test_addWebServer_CSP_REPORT_ONLY_False(self):
-        """Call :func:`bridgedb.https.server.addWebServer` with
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` with
         ``CSP_REPORT_ONLY=False`` to test startup.
         """
         config = self.config
@@ -1036,7 +1036,7 @@ class HTTPSServerServiceTests(unittest.TestCase):
         server.addWebServer(config, self.distributor)
 
     def test_addWebServer_CSP_INCLUDE_SELF_False(self):
-        """Call :func:`bridgedb.https.server.addWebServer` with
+        """Call :func:`bridgedb.distributors.https.server.addWebServer` with
         ``CSP_INCLUDE_SELF=False`` to test startup.
         """
         config = self.config
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index f1f5fa4..906d5fe 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -34,19 +34,19 @@ import bridgedb.Bridges
 import bridgedb.Bucket
 import bridgedb.crypto
 import bridgedb.distribute
-import bridgedb.email
-import bridgedb.email.autoresponder
-import bridgedb.email.distributor
-import bridgedb.email.dkim
-import bridgedb.email.request
-import bridgedb.email.server
-import bridgedb.email.templates
+import bridgedb.distributors.email
+import bridgedb.distributors.email.autoresponder
+import bridgedb.distributors.email.distributor
+import bridgedb.distributors.email.dkim
+import bridgedb.distributors.email.request
+import bridgedb.distributors.email.server
+import bridgedb.distributors.email.templates
 import bridgedb.filters
 import bridgedb.geo
-import bridgedb.https
-import bridgedb.https.distributor
-import bridgedb.https.request
-import bridgedb.https.server
+import bridgedb.distributors.https
+import bridgedb.distributors.https.distributor
+import bridgedb.distributors.https.request
+import bridgedb.distributors.https.server
 import bridgedb.Main
 import bridgedb.parse
 import bridgedb.parse.addr
diff --git a/setup.py b/setup.py
index 955a720..a133424 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ repo_langs = os.path.join(pkgpath, '_langs.py')
 
 # The directory containing template files and other resources to serve on the
 # web server:
-repo_templates = os.path.join(pkgpath, 'https', 'templates')
+repo_templates = os.path.join(pkgpath, 'distributors', 'https', 'templates')
 
 # The directories to install non-sourcecode resources into should always be
 # given as relative paths, in order to force distutils to install relative to
@@ -375,8 +375,9 @@ setuptools.setup(
     download_url='https://gitweb.torproject.org/bridgedb.git',
     package_dir={'bridgedb': 'bridgedb'},
     packages=['bridgedb',
-              'bridgedb.email',
-              'bridgedb.https',
+              'bridgedb.distributors',
+              'bridgedb.distributors.email',
+              'bridgedb.distributors.https',
               'bridgedb.parse',
               'bridgedb.test',
           ],
@@ -395,7 +396,7 @@ setuptools.setup(
     message_extractors={
         pkgpath: [
             ('**.py', 'python', None),
-            ('https/templates/**.html', 'mako', None),
+            ('distributors/https/templates/**.html', 'mako', None),
         ]
     },
 )



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits