You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2016/06/01 12:41:06 UTC
[04/11] incubator-ponymail git commit: make archiver import-able
outside of mailman
make archiver import-able outside of mailman
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/2bf40b56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/2bf40b56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/2bf40b56
Branch: refs/heads/master
Commit: 2bf40b5654522dc6b8d64043f86ef40c60a748e2
Parents: 6bcb491
Author: Sam Ruby <ru...@intertwingly.net>
Authored: Wed May 4 07:50:30 2016 -0400
Committer: Sam Ruby <ru...@intertwingly.net>
Committed: Wed May 4 07:50:30 2016 -0400
----------------------------------------------------------------------
tools/archiver.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/2bf40b56/tools/archiver.py
----------------------------------------------------------------------
diff --git a/tools/archiver.py b/tools/archiver.py
index 4ba0c5d..cdd52e1 100644
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -35,15 +35,6 @@ sub someone to the list(s) and add this to their .forward file:
# Change this index name to whatever you picked!!
indexname = "ponymail_alpha"
logger = None
-if __name__ != '__main__':
- from zope.interface import implementer
- from mailman.interfaces.archiver import IArchiver
- from mailman.interfaces.archiver import ArchivePolicy
- import logging
- logger = logging.getLogger("mailman.archiver")
-else:
- import sys
- import argparse
from elasticsearch import Elasticsearch
import hashlib
@@ -65,6 +56,15 @@ config.read("%s/ponymail.cfg" % path)
auth = None
parseHTML = False
+if config.has_section('archiver.ponymail'):
+ from zope.interface import implementer
+ from mailman.interfaces.archiver import IArchiver
+ from mailman.interfaces.archiver import ArchivePolicy
+ import logging
+ logger = logging.getLogger("mailman.archiver")
+elif __name__ == '__main__':
+ import sys
+ import argparse
if config.has_option('elasticsearch', 'user'):
auth = (config.get('elasticsearch','user'), config.get('elasticsearch','password'))
@@ -103,7 +103,7 @@ def pm_charsets(msg):
class Archiver(object):
""" A mailman 3 archiver that forwards messages to pony mail. """
- if __name__ != '__main__':
+ if config.has_section('archiver.ponymail'):
implementer(IArchiver)
name = "ponymail"