This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A simple and stupid override for singing dancing

if there is an STMTP exception raised the process queue stop but dispatch is not notice of that.

In the try, catch doesn’t work in that case because of the architecture of zope.sendmail I guess. I think that collective.dancing.composer.SMTPMailer.send must have a try ... except in that case. Exceptions in smtplib are :

“SMTPException”, “SMTPServerDisconnected”, “SMTPResponseException”, “SMTPSenderRefused”, “SMTPRecipientsRefused”, “SMTPDataError”, “SMTPConnectError”, “SMTPHeloError”, “SMTPAuthenticationError”,

SMTPRecipientsRefused and SMTPSenderRefused are not critical error for the dispatch process and I think they can be catch in the SMTPMailer. In my case , recipients received hundred message of the same newsletter because the queue failed of a empty email address. The queue is never purge and the @@dancing.utils/tick_and_dispatch finish by blocking zope server.

The traceback:

INFO collective.singing Dispatching is locked by another process.

CRITICAL txn.16292 A storage error occurred during the second phase of the
two-phase commit.  Resources may be in an inconsistent state.

2009-05-25T09:48:09 ERROR Zope.SiteErrorLog

Traceback (innermost last):

 Module ZPublisher.Publish, line 125, in publish

 Module Zope2.App.startup, line 238, in commit

 Module transaction._manager, line 96, in commit

 Module transaction._transaction, line 395, in commit

 Module transaction._transaction, line 503, in _commitResources

 Module, line 87, in tpc_finish

 Module collective.dancing.composer, line 376, in send

 Module zope.sendmail.mailer, line 72, in send

 Module smtplib, line 695, in sendmail

SMTPRecipientsRefused: {}

So the goal of this egg is to avoid that !!:

>>> from zope.component import getUtility
>>> from zope.sendmail.mailer import ISMTPMailer
>>> utility = getUtility(ISMTPMailer, name= 'patchplone.smtp')
>>> utility

Provide an simple patch to smtplib:

>>> from zope.sendmail.mailer import SMTPMailer
>>> from smtplib import SMTPRecipientsRefused
>>> from smtplib import SMTPSenderRefused
>>> def new_send(self, from_addr, to_addrs, msg):
...    if to_addrs == ['']:
...        raise SMTPSenderRefused(500, 'failed',to_addrs)
...    elif to_addrs == []:
...        raise SMTPRecipientsRefused(to_addrs)
...    else:
...        return {}

>>> SMTPMailer.send = new_send

So now test the function:

>>> utility.send('',['',],'')
>>> utility.send('',['',],'')
>>> utility.send('',[],'')

Changes log


  • Cleaned restructuredtext in docs [glenfant]


  • Added z3c.autoinclude awareness [glenfant]
  • Issue (warning) in unknown option in [glenfant]


  • Initial release
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting