{ "info": { "author": "yboussard", "author_email": "y.boussard@ingeniweb.com", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. $Id: README.txt 71870 2010-12-11 17:57:38Z glenfant $\n\n======================\n patch.singingdancing\n======================\n\n.. rubric:: A simple and stupid override for singing dancing\n\nif there is an STMTP exception raised the process queue stop but dispatch is not\nnotice of that.\n\nIn\nhttp://svn.plone.org/svn/collective/collective.singing/trunk/collective/singing/message.py\nthe try, catch doesn't work in that case because of the architecture of\nzope.sendmail I guess. I think that\n``collective.dancing.composer.SMTPMailer.send`` must have a ``try ... except``\nin that case. Exceptions in ``smtplib`` are :\n\n\"SMTPException\", \"SMTPServerDisconnected\", \"SMTPResponseException\",\n\"SMTPSenderRefused\", \"SMTPRecipientsRefused\", \"SMTPDataError\",\n\"SMTPConnectError\", \"SMTPHeloError\", \"SMTPAuthenticationError\",\n\n``SMTPRecipientsRefused`` and ``SMTPSenderRefused`` are not critical error for\nthe dispatch process and I think they can be catch in the ``SMTPMailer``. In my\ncase , recipients received hundred message of the same newsletter because the\nqueue failed of a empty email address. The queue is never purge and the\n``@@dancing.utils/tick_and_dispatch`` finish by blocking zope server.\n\nThe traceback: ::\n\n INFO collective.singing Dispatching is locked by another process.\n\n CRITICAL txn.16292 A storage error occurred during the second phase of the\n two-phase commit. Resources may be in an inconsistent state.\n\n 2009-05-25T09:48:09 ERROR Zope.SiteErrorLog\n .../@@dancing.utils/tick_and_dispatch\n\n Traceback (innermost last):\n\n Module ZPublisher.Publish, line 125, in publish\n\n Module Zope2.App.startup, line 238, in commit\n\n Module transaction._manager, line 96, in commit\n\n Module transaction._transaction, line 395, in commit\n\n Module transaction._transaction, line 503, in _commitResources\n\n Module zope.sendmail.delivery, line 87, in tpc_finish\n\n Module collective.dancing.composer, line 376, in send\n\n Module zope.sendmail.mailer, line 72, in send\n\n Module smtplib, line 695, in sendmail\n\n SMTPRecipientsRefused: {}\n\nSo the goal of this egg is to avoid that !!::\n\n >>> from zope.component import getUtility\n >>> from zope.sendmail.mailer import ISMTPMailer\n >>> utility = getUtility(ISMTPMailer, name= 'patchplone.smtp')\n >>> utility\n \n\nProvide an simple patch to smtplib: ::\n\n >>> from zope.sendmail.mailer import SMTPMailer\n >>> from smtplib import SMTPRecipientsRefused\n >>> from smtplib import SMTPSenderRefused\n >>> def new_send(self, from_addr, to_addrs, msg):\n ... if to_addrs == ['toto@host.com']:\n ... raise SMTPSenderRefused(500, 'failed',to_addrs)\n ... elif to_addrs == []:\n ... raise SMTPRecipientsRefused(to_addrs)\n ... else:\n ... return {}\n\n >>> SMTPMailer.send = new_send\n\nSo now test the function: ::\n\n\n >>> utility.send('y.boussard@ingeniweb.com',['y.boussard@free.fr',],'')\n {}\n >>> utility.send('y.boussard@ingeniweb.com',['toto@host.com',],'')\n {'toto@host.com':...}\n >>> utility.send('y.boussard@ingeniweb.com',[],'')\n {'y.boussard@ingeniweb.com':...}\n\nChanges log\n===========\n\n1.0.2\n-----\n\n* Cleaned restructuredtext in docs\n [glenfant]\n\n1.0.1\n-----\n\n* Added z3c.autoinclude awareness\n [glenfant]\n* Issue (warning) in unknown option in setup.py\n [glenfant]\n\n1.0\n---\n\n* Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://svn.ingeniweb.com/svn/ingeniweb/zope/projects/loreal/dpl-dt/marketsurfer/packages/patch.singingdancing", "keywords": "patch singing dancing marketsurfer", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "patch.singingdancing", "package_url": "https://pypi.org/project/patch.singingdancing/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/patch.singingdancing/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://svn.ingeniweb.com/svn/ingeniweb/zope/projects/loreal/dpl-dt/marketsurfer/packages/patch.singingdancing" }, "release_url": "https://pypi.org/project/patch.singingdancing/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "A patch for singing dancing that logs SMTP errors", "version": "1.0.2" }, "last_serial": 755465, "releases": { "1.0.2": [] }, "urls": [] }