[CMF-checkins] CVS: CMF/CMFCollector - CollectorIssue.py:1.32
Ken Manheimer
klm@zope.com
Thu, 15 Nov 2001 17:59:50 -0500
Update of /cvs-repository/CMF/CMFCollector
In directory cvs.zope.org:/tmp/cvs-serv14338
Modified Files:
CollectorIssue.py
Log Message:
Implemented tolerance for sendmail delivery problems, without
completely hiding the problems.
._send_update_notice(): Trap deliver errors and return a string with
the message, if they happen - or None, if no errors occur.
.do_action(): Return the result from _send_update_notice().
.__init__(): Moved the initial call to .do_action() to
addCollectorIssue(), so the result can be propagated.
addCollectorIssue(): Call .do_action(), and return the result so
errors get noticed.
=== CMF/CMFCollector/CollectorIssue.py 1.31 => 1.32 ===
import os, urllib, string, re
+import smtplib
+
from DateTime import DateTime
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo, getSecurityManager
@@ -150,9 +152,6 @@
modification_date = self.creation_date
self.modification_date = modification_date
- contained.do_action('request', description, assignees,
- file, fileid, filetype)
-
def _set_submitter_specs(self, submitter_id,
submitter_name, submitter_email):
"""Given an id, set the name and email as warranted."""
@@ -365,9 +364,10 @@
or '')
+ transcript.EditableBody())
self.reindexObject()
- self._send_update_notice(action, username,
- orig_status, additions, removals,
- file=file, fileid=fileid)
+ got = self._send_update_notice(action, username,
+ orig_status, additions, removals,
+ file=file, fileid=fileid)
+ return got
def _supporters_diff(self, orig_supporters):
"""Indicate supporter roster changes, relative to orig_supporters.
@@ -491,7 +491,12 @@
body=body,
candidates=candidates)
mh = self.MailHost
- mh.send(message)
+ try:
+ mh.send(message)
+ except:
+ import sys
+ err = sys.exc_info()
+ return "Email notice error: '%s'" % str(err[1])
def _process_file(self, file, fileid, filetype, comment):
"""Upload file to issue if it is substantial (has a name).
@@ -717,9 +722,9 @@
assignees=None,
file=None, fileid=None, filetype=None,
REQUEST=None):
- """
- Create a new issue in the collector.
- """
+ """Create a new issue in the collector.
+
+ We return a string indicating any errors, or None if there weren't any."""
it = CollectorIssue(id=id,
container=self,
@@ -736,4 +741,8 @@
version_info=version_info,
assignees=assignees,
file=file, fileid=fileid, filetype=filetype)
- return id
+ it = self._getOb(it.id)
+ got = it.do_action('request', description, assignees,
+ file, fileid, filetype)
+
+ return got