diff options
| -rw-r--r-- | mailman/docs/lifecycle.txt | 1 | ||||
| -rw-r--r-- | mailman/docs/styles.txt | 3 | ||||
| -rw-r--r-- | mailman/pipeline/docs/scrubber.txt | 5 | ||||
| -rw-r--r-- | mailman/pipeline/scrubber.py | 3 | ||||
| -rw-r--r-- | mailman/queue/__init__.py | 5 | ||||
| -rw-r--r-- | mailman/testing/layers.py | 16 | ||||
| -rw-r--r-- | mailman/tests/test_documentation.py | 1 |
7 files changed, 23 insertions, 11 deletions
diff --git a/mailman/docs/lifecycle.txt b/mailman/docs/lifecycle.txt index 8531c6245..ab5e6ac23 100644 --- a/mailman/docs/lifecycle.txt +++ b/mailman/docs/lifecycle.txt @@ -57,6 +57,7 @@ Start by registering a test style. ... # Applies to any test list ... if 'test' in mailing_list.fqdn_listname: ... styles.append(self) + >>> from mailman.core.styles import style_manager >>> style_manager.register(TestStyle()) diff --git a/mailman/docs/styles.txt b/mailman/docs/styles.txt index 6397666ae..f75a34798 100644 --- a/mailman/docs/styles.txt +++ b/mailman/docs/styles.txt @@ -14,7 +14,8 @@ modify the mailing list any way it wants. Let's start with a vanilla mailing list and a default style manager. >>> mlist = config.db.list_manager.create(u'_xtest@example.com') - >>> from mailman.core.styles import style_manager + >>> from mailman.core.styles import StyleManager + >>> style_manager = StyleManager() The default style diff --git a/mailman/pipeline/docs/scrubber.txt b/mailman/pipeline/docs/scrubber.txt index 9c9367cda..eddd1939d 100644 --- a/mailman/pipeline/docs/scrubber.txt +++ b/mailman/pipeline/docs/scrubber.txt @@ -50,7 +50,8 @@ filename suggested in the message's Content-Disposition: header or not. If enabled, the filename will be used when this header attribute is present (yes, this is an unfortunate double negative). - >>> config.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = False + >>> from mailman import Defaults + >>> Defaults.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = False >>> msg = message_from_string("""\ ... Content-Type: image/gif; name="xtest.gif" ... Content-Transfer-Encoding: base64 @@ -79,7 +80,7 @@ The site administrator can also configure Mailman to ignore the Content-Disposition: filename. This is the default for reasons described in the Defaults.py.in file. - >>> config.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = True + >>> Defaults.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME = True >>> msg = message_from_string("""\ ... Content-Type: image/gif; name="xtest.gif" ... Content-Transfer-Encoding: base64 diff --git a/mailman/pipeline/scrubber.py b/mailman/pipeline/scrubber.py index e8268f0cf..a0e88b7d8 100644 --- a/mailman/pipeline/scrubber.py +++ b/mailman/pipeline/scrubber.py @@ -40,6 +40,7 @@ from zope.interface import implements from mailman import Defaults from mailman import Utils +from mailman.config import config from mailman.core.errors import DiscardMessage from mailman.core.plugins import get_plugin from mailman.i18n import _ @@ -394,7 +395,7 @@ def makedirs(dir): def save_attachment(mlist, msg, dir, filter_html=True): - fsdir = os.path.join(Defaults.PRIVATE_ARCHIVE_FILE_DIR, + fsdir = os.path.join(config.PRIVATE_ARCHIVE_FILE_DIR, mlist.fqdn_listname, dir) makedirs(fsdir) # Figure out the attachment type and get the decoded data diff --git a/mailman/queue/__init__.py b/mailman/queue/__init__.py index 5aa72bb14..239c61326 100644 --- a/mailman/queue/__init__.py +++ b/mailman/queue/__init__.py @@ -343,7 +343,8 @@ class Runner: # permissions problem or a MemoryError due to a really large # message. Try to be graceful. try: - new_filebase = self._shunt.enqueue(msg, msgdata) + shunt = config.switchboards['shunt'] + new_filebase = shunt.enqueue(msg, msgdata) elog.error('SHUNTING: %s', new_filebase) self.switchboard.finish(filebase) except Exception, e: @@ -382,7 +383,7 @@ class Runner: if mlist is None: elog.error('Dequeuing message destined for missing list: %s', listname) - self._shunt.enqueue(msg, msgdata) + config.switchboards['shunt'].enqueue(msg, msgdata) return # Now process this message. We also want to set up the language # context for this message. The context will be the preferred diff --git a/mailman/testing/layers.py b/mailman/testing/layers.py index 5976d9e4e..656bac5bd 100644 --- a/mailman/testing/layers.py +++ b/mailman/testing/layers.py @@ -36,8 +36,9 @@ from textwrap import dedent from mailman.config import config from mailman.core import initialize -from mailman.i18n import _ from mailman.core.logging import get_handler +from mailman.core.styles import style_manager +from mailman.i18n import _ from mailman.testing.helpers import SMTPServer @@ -135,11 +136,13 @@ class ConfigLayer: cls.var_dir = None @classmethod - def testSetUp(self): - pass + def testSetUp(cls): + # Record the current (default) set of styles so that we can reset them + # easily in the tear down. + cls.styles = set(style_manager.styles) @classmethod - def testTearDown(self): + def testTearDown(cls): # Reset the database between tests. config.db._reset() # Remove all residual queue files. @@ -150,6 +153,11 @@ class ConfigLayer: for message in config.db.message_store.messages: config.db.message_store.delete_message(message['message-id']) config.db.commit() + # Reset the global style manager. + new_styles = set(style_manager.styles) - cls.styles + for style in new_styles: + style_manager.unregister(style) + cls.styles = None # Flag to indicate that loggers should propagate to the console. stderr = False diff --git a/mailman/tests/test_documentation.py b/mailman/tests/test_documentation.py index 51dc784fe..c4df8444e 100644 --- a/mailman/tests/test_documentation.py +++ b/mailman/tests/test_documentation.py @@ -38,7 +38,6 @@ import mailman from mailman.Message import Message from mailman.config import config -from mailman.core.styles import style_manager from mailman.testing.layers import SMTPLayer |
