[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/mail/ Small
formatting fixes.
Marius Gedminas
marius at pov.lt
Fri Apr 21 12:23:50 EDT 2006
Log message for revision 67223:
Small formatting fixes.
Changed:
U Zope3/trunk/src/zope/app/mail/delivery.py
U Zope3/trunk/src/zope/app/mail/interfaces.py
U Zope3/trunk/src/zope/app/mail/maildir.py
U Zope3/trunk/src/zope/app/mail/metaconfigure.py
U Zope3/trunk/src/zope/app/mail/metadirectives.py
U Zope3/trunk/src/zope/app/mail/tests/test_delivery.py
U Zope3/trunk/src/zope/app/mail/tests/test_maildir.py
U Zope3/trunk/src/zope/app/mail/tests/test_mailer.py
-=-
Modified: Zope3/trunk/src/zope/app/mail/delivery.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/delivery.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/delivery.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -24,7 +24,6 @@
import logging
import atexit
import time
-
from os import unlink, getpid
from cStringIO import StringIO
from random import randrange
@@ -37,6 +36,7 @@
from transaction.interfaces import IDataManager
import transaction
+
class MailDataManager(object):
implements(IDataManager)
@@ -60,6 +60,7 @@
# No subtransaction support.
def abort_sub(self, transaction):
pass
+
commit_sub = abort_sub
def beforeCompletion(self, transaction):
@@ -75,6 +76,7 @@
tpc_finish = tpc_abort = tpc_vote
+
class AbstractMailDelivery(object):
def newMessageId(self):
@@ -131,10 +133,12 @@
msg.write(message)
return MailDataManager(msg.commit, onAbort=msg.abort)
+
class QueueProcessorThread(threading.Thread):
"""This thread is started at configuration time from the
`mail:queuedDelivery` directive handler.
"""
+
log = logging.getLogger("QueueProcessorThread")
__stopped = False
@@ -202,11 +206,11 @@
if fromaddr != '' or toaddrs != ():
self.log.error(
"Error while sending mail from %s to %s.",
- fromaddr, ", ".join(toaddrs), exc_info=1)
+ fromaddr, ", ".join(toaddrs), exc_info=True)
else:
self.log.error(
"Error while sending mail : %s ",
- filename, exc_info=1)
+ filename, exc_info=True)
else:
if forever:
time.sleep(3)
Modified: Zope3/trunk/src/zope/app/mail/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/interfaces.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/interfaces.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -42,7 +42,7 @@
- An `IMailQueueProcessor` or `IDirectMailDelivery` actually delivers the
messages by using a mailer (`IMailer`) component that encapsulates the
- delivery process. There are currently two mailers:
+ delivery process. There currently is only one mailer:
- `ISMTPMailer` sends all messages to a relay host using SMTP
@@ -77,8 +77,8 @@
Returns the message ID.
- You can subscribe to `IMailEvent` events for notification about problems
- or successful delivery.
+ You can subscribe to `IMailEvent` events for notification about
+ problems or successful delivery.
Messages are actually sent during transaction commit.
"""
@@ -259,3 +259,4 @@
Calling ``abort()`` more than once is allowed.
"""
+
Modified: Zope3/trunk/src/zope/app/mail/maildir.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/maildir.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/maildir.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -26,6 +26,7 @@
from zope.app.mail.interfaces import \
IMaildirFactory, IMaildir, IMaildirMessageWriter
+
class Maildir(object):
"""See `zope.app.interfaces.mail.IMaildir`"""
Modified: Zope3/trunk/src/zope/app/mail/metaconfigure.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metaconfigure.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/metaconfigure.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -36,8 +36,8 @@
checker = InterfaceChecker(interfaces, permission)
return proxify(component, checker)
-
+
def queuedDelivery(_context, permission, queuePath, mailer, name="Mail"):
def createQueuedDelivery():
Modified: Zope3/trunk/src/zope/app/mail/metadirectives.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/metadirectives.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/metadirectives.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -22,10 +22,11 @@
from zope.schema import TextLine, ASCII, BytesLine, Int
from zope.app.security.fields import Permission
+
class IDeliveryDirective(Interface):
"""This abstract directive describes a generic mail delivery utility
registration."""
-
+
name = TextLine(
title=u"Name",
description=u'Specifies the Delivery name of the mail utility. '\
@@ -37,7 +38,7 @@
title=u"Permission",
description=u"Defines the permission needed to use this service.",
required=True)
-
+
mailer = TextLine(
title=u"Mailer",
description=u"Defines the mailer to be used for sending mail.",
@@ -66,8 +67,8 @@
title=u"Name",
description=u"Name of the Mailer.",
required=True)
-
+
class ISMTPMailerDirective(IMailerDirective):
"""Registers a new SMTP mailer."""
Modified: Zope3/trunk/src/zope/app/mail/tests/test_delivery.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_delivery.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/tests/test_delivery.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -17,11 +17,12 @@
$Id$
"""
+
import os.path
from tempfile import mktemp
from unittest import TestCase, TestSuite, makeSuite
-import transaction
+import transaction
from zope.interface import implements
from zope.interface.verify import verifyObject
from zope.app.mail.interfaces import IMailer
@@ -243,14 +244,11 @@
self.thread.log = LoggerStub()
def test_parseMessage(self):
-
hdr = ('X-Zope-From: foo at example.com\n'
'X-Zope-To: bar at example.com, baz at example.com\n')
msg = ('Header: value\n'
'\n'
'Body\n')
-
-
f, t, m = self.thread._parseMessage(hdr + msg)
self.assertEquals(f, 'foo at example.com')
self.assertEquals(t, ('bar at example.com', 'baz at example.com'))
@@ -276,7 +274,6 @@
'bar at example.com, baz at example.com'),
{})])
-
def test_error_logging(self):
self.thread.setMailer(BrokenMailerStub())
self.filename = mktemp()
@@ -294,7 +291,6 @@
{'exc_info': 1})])
-
def test_suite():
return TestSuite((
makeSuite(TestMailDataManager),
Modified: Zope3/trunk/src/zope/app/mail/tests/test_maildir.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_maildir.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/tests/test_maildir.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -160,7 +160,7 @@
# Case 2a: directory does not exist, create = False
self.assertRaises(ValueError, Maildir, '/path/to/nosuchfolder', False)
-
+
# Case 2b: directory does not exist, create = True
m = Maildir('/path/to/nosuchfolder', True)
verifyObject(IMaildir, m)
Modified: Zope3/trunk/src/zope/app/mail/tests/test_mailer.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_mailer.py 2006-04-21 15:17:22 UTC (rev 67222)
+++ Zope3/trunk/src/zope/app/mail/tests/test_mailer.py 2006-04-21 16:23:50 UTC (rev 67223)
@@ -90,7 +90,6 @@
self.assert_(self.smtp.quit)
-
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSMTPMailer))
More information about the Zope3-Checkins
mailing list