[Checkins] SVN: zope.sendmail/trunk/ Added the new parameter ``processorThread`` to the queuedDelivery ZCML

Fabio Tranchitella kobold at kobold.it
Thu Jan 7 01:31:55 EST 2010


Log message for revision 107769:
  Added the new parameter ``processorThread`` to the queuedDelivery ZCML
  directive: if False, the QueueProcessorThread is not started and thus an
  independent process must process the queue; it defaults to True for b/c.
  
  
  

Changed:
  U   zope.sendmail/trunk/CHANGES.txt
  U   zope.sendmail/trunk/src/zope/sendmail/zcml.py

-=-
Modified: zope.sendmail/trunk/CHANGES.txt
===================================================================
--- zope.sendmail/trunk/CHANGES.txt	2010-01-07 06:24:05 UTC (rev 107768)
+++ zope.sendmail/trunk/CHANGES.txt	2010-01-07 06:31:54 UTC (rev 107769)
@@ -13,6 +13,10 @@
 - Sort by modification time the messages in zope.sendmail.maildir so earlier
   messages are sent before later messages during queue processing.
 
+- Added the new parameter ``processorThread`` to the queuedDelivery ZCML
+  directive: if False, the QueueProcessorThread is not started and thus an
+  independent process must process the queue; it defaults to True for b/c.
+
 3.6.1 (2009-11-16)
 ------------------
 

Modified: zope.sendmail/trunk/src/zope/sendmail/zcml.py
===================================================================
--- zope.sendmail/trunk/src/zope/sendmail/zcml.py	2010-01-07 06:24:05 UTC (rev 107768)
+++ zope.sendmail/trunk/src/zope/sendmail/zcml.py	2010-01-07 06:31:54 UTC (rev 107769)
@@ -22,7 +22,7 @@
 from zope.configuration.fields import Path
 from zope.configuration.exceptions import ConfigurationError
 from zope.interface import Interface
-from zope.schema import TextLine, BytesLine, Int
+from zope.schema import TextLine, BytesLine, Int, Bool
 
 from zope.sendmail.delivery import QueuedMailDelivery, DirectMailDelivery
 from zope.sendmail.delivery import QueueProcessorThread
@@ -76,8 +76,17 @@
         description=u"Defines the path for the queue directory.",
         required=True)
 
-def queuedDelivery(_context, queuePath, mailer, permission=None, name="Mail"):
+    processorThread = Bool(
+        title=u"Run Queue Processor Thread",
+        description=u"Indicates whether to run queue processor in a thread "
+            "in this process.",
+        required=False,
+        default=True)
 
+
+def queuedDelivery(_context, queuePath, mailer, permission=None, name="Mail",
+    processorThread=True):
+
     def createQueuedDelivery():
         delivery = QueuedMailDelivery(queuePath)
         if permission is not None:
@@ -89,10 +98,11 @@
         if mailerObject is None:
             raise ConfigurationError("Mailer %r is not defined" %mailer)
 
-        thread = QueueProcessorThread()
-        thread.setMailer(mailerObject)
-        thread.setQueuePath(queuePath)
-        thread.start()
+        if processorThread:
+            thread = QueueProcessorThread()
+            thread.setMailer(mailerObject)
+            thread.setQueuePath(queuePath)
+            thread.start()
 
     _context.action(
             discriminator = ('delivery', name),



More information about the checkins mailing list