SF.net SVN: tmda: [2039] trunk/tmda
[email protected] Thu, 28 Sep 2006 13:08:27 -0700
| Newsgroups | gmane.mail.spam.tmda.cvs |
|---|---|
| Message-ID | <[email protected]> |
Revision: 2039
http://svn.sourceforge.net/tmda/?rev=2039&view=rev
Author: jasonrm
Date: 2006-09-28 13:08:23 -0700 (Thu, 28 Sep 2006)
Log Message:
-----------
Add Defaults.PENDING_QUEUE_FORMAT, a config variable to specify the format of the
pending queue. Currently the only (and default) option is 'original'.
Modified Paths:
--------------
trunk/tmda/TMDA/ChangeLog
trunk/tmda/TMDA/Defaults.py
trunk/tmda/TMDA/Pending.py
trunk/tmda/TMDA/Queue/Queue.py
trunk/tmda/TMDA/Queue/Util.py
trunk/tmda/bin/tmda-rfilter
Modified: trunk/tmda/TMDA/ChangeLog
===================================================================
--- trunk/tmda/TMDA/ChangeLog 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/TMDA/ChangeLog 2006-09-28 20:08:23 UTC (rev 2039)
@@ -1,3 +1,7 @@
+2006-09-28 Jason R. Mastaler <[email protected]>
+
+ * Defaults.py (PENDING_QUEUE_FORMAT): New variable.
+
2006-09-27 Jason R. Mastaler <[email protected]>
* Pending.py: Modified to use new Tmda.Queue interface.
Modified: trunk/tmda/TMDA/Defaults.py
===================================================================
--- trunk/tmda/TMDA/Defaults.py 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/TMDA/Defaults.py 2006-09-28 20:08:23 UTC (rev 2039)
@@ -1050,6 +1050,20 @@
if not vars().has_key('PENDING_DIR'):
PENDING_DIR = os.path.join(DATADIR, 'pending')
+# PENDING_QUEUE_FORMAT
+# A string specifying the format of TMDA's pending queue where
+# unconfirmed messages are stored.
+# Possible values include:
+#
+# "original"
+# A custom TMDA format where messages are stored one per file in a
+# directory (PENDING_DIR). Offers high performance, but can only
+# be browsed with TMDA tools like 'tmda-pending' and 'tmda-cgi'.
+#
+# Default is "original".
+if not vars().has_key('PENDING_QUEUE_FORMAT'):
+ PENDING_QUEUE_FORMAT = 'original'
+
# PENDING_LIFETIME
# A time interval describing how long a message can live in the
# pending queue before it's subject to automated deletion by
Modified: trunk/tmda/TMDA/Pending.py
===================================================================
--- trunk/tmda/TMDA/Pending.py 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/TMDA/Pending.py 2006-09-28 20:08:23 UTC (rev 2039)
@@ -33,10 +33,11 @@
import Defaults
import Errors
import Util
-from TMDA.Queue.OriginalQueue import OriginalQueue
+from TMDA.Queue.Queue import Queue
-Q = OriginalQueue()
+Q = Queue()
+Q = Q.init()
class Queue:
Modified: trunk/tmda/TMDA/Queue/Queue.py
===================================================================
--- trunk/tmda/TMDA/Queue/Queue.py 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/TMDA/Queue/Queue.py 2006-09-28 20:08:23 UTC (rev 2039)
@@ -27,7 +27,10 @@
currently comes from a timestamp and the Python process id.
"""
+from TMDA import Defaults
+from TMDA import Errors
+
class Queue:
def __init__(self):
self.format = "not defined"
@@ -106,3 +109,19 @@
Return true if this message is in the queue, otherwise False.
"""
pass
+
+
+ # Subclasses should not override this method.
+
+ def init(self):
+ qformat = Defaults.PENDING_QUEUE_FORMAT
+ if qformat.lower() == 'original':
+ from OriginalQueue import OriginalQueue
+ return OriginalQueue()
+ #if qformat.lower() == 'maildir':
+ # from MaildirQueue import MaildirQueue
+ # return MaildirQueue()
+ else:
+ raise Errors.ConfigError, \
+ "Unknown PENDING_QUEUE_FORMAT: " + '"%s"' % qformat
+
Modified: trunk/tmda/TMDA/Queue/Util.py
===================================================================
--- trunk/tmda/TMDA/Queue/Util.py 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/TMDA/Queue/Util.py 2006-09-28 20:08:23 UTC (rev 2039)
@@ -22,10 +22,3 @@
"""General purpose (Pending Queue related) functions."""
-
-# def maildirmake(dirpath):
-# """ """
-# os.makedirs(os.path.join(dirpath, 'cur'), 0700)
-# os.mkdir(os.path.join(dirpath, 'new'), 0700)
-# os.mkdir(os.path.join(dirpath, 'tmp'), 0700)
-
Modified: trunk/tmda/bin/tmda-rfilter
===================================================================
--- trunk/tmda/bin/tmda-rfilter 2006-09-28 17:50:58 UTC (rev 2038)
+++ trunk/tmda/bin/tmda-rfilter 2006-09-28 20:08:23 UTC (rev 2039)
@@ -179,7 +179,7 @@
from TMDA import FilterParser
from TMDA import MTA
from TMDA import Util
-from TMDA.Queue.OriginalQueue import OriginalQueue
+from TMDA.Queue.Queue import Queue
from cStringIO import StringIO
from email.Utils import parseaddr, getaddresses
@@ -205,7 +205,8 @@
MAILID = "%s.%s" % (TIMESTAMP, Defaults.PID)
# A pending queue instance
-Q = OriginalQueue()
+Q = Queue()
+Q = Q.init()
# We use this MTA instance to control the fate of the message.
mta = MTA.init(Defaults.MAIL_TRANSFER_AGENT, Defaults.DELIVERY)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.