[CMF-checkins] CVS: CMF/CMFCollector - CollectorIssue.py:1.18
Ken Manheimer
klm@zope.com
Sat, 27 Oct 2001 18:52:52 -0400
Update of /cvs-repository/CMF/CMFCollector
In directory cvs.zope.org:/tmp/cvs-serv30165
Modified Files:
CollectorIssue.py
Log Message:
Adding email address option for anonymous submitters (and alternate
delivery address, for members).
When the submitter is anonymous, the explicitly specified email
address is essential - in its absence, supporters doing followups are
informed that the submitter will not get email notification.
.__init__(), .edit(), ._send_update_notice(): When the submitter is a
member (with an email address preference), an explicitly specified
email address overrides the preference. If the email address is the
*same* as the preference, then the explicitly specified setting is
wiped (set to None), and the preference is used from then on. This
way, the submitter's preference is tracked thereafter.
.no_submitter_email(): Helper for followup form, so the supporter can
be informed that the submitter won't be getting a notification.
=== CMF/CMFCollector/CollectorIssue.py 1.17 => 1.18 ===
'Resolve', 'Reject', 'Defer']
+ # Accumulated instance-data backwards-compatability values:
_collector_path = None
-
+ submitter_email = None
version_info = ''
def __init__(self,
id, container,
title='', description='',
- submitter_id=None, submitter_name=None,
+ submitter_id=None, submitter_name=None, submitter_email=None,
kibitzers=None,
security_related=0,
topic=None, classification=None, importance=None,
@@ -120,13 +121,16 @@
submitter_id = str(user)
self.submitter_id = submitter_id
if submitter_name is None:
- if hasattr(user, 'full_name'):
- submitter_name = user.full_name
- elif (submitter_name
- and (getattr(user, 'full_name', None) != submitter_name)):
- # XXX We're being cavalier about stashing the full_name.
- user.full_name = submitter_name
+ n = user.getProperty('full_name', '')
+ if n: submitter_name = n
self.submitter_name = submitter_name
+ email_pref = user.getProperty('email', '')
+ if submitter_email and submitter_email == email_pref:
+ # A bit different than you'd expect: only stash the specified
+ # email if it's different than the member-preference. Otherwise,
+ # stash None, so the preference is tracked at send time.
+ submitter_email = None
+ self.submitter_email = submitter_email
if kibitzers is None:
kibitzers = ()
@@ -162,6 +166,17 @@
# time we don't have an acquisition content to use...
self._collector_path = "/".join(collector.getPhysicalPath())
+ security.declareProtected(EditCollectorIssue, 'no_submitter_email')
+ def no_submitter_email(self):
+ """True if there's no way to get an email address for the submitter."""
+ if self.submitter_email:
+ return 0
+ if self.submitter_id != str(self.acl_users._nobody):
+ member = self.portal_membership.getMemberById(self.submitter_id)
+ if member and member.getProperty('email', ''):
+ return 0
+ return 1
+
security.declareProtected(CMFCorePermissions.View, 'CookedBody')
def CookedBody(self):
"""Massage the transcript's cooked body to linkify obvious things."""
@@ -351,7 +366,6 @@
new_status = string.split(self.status(), '_')[0]
recipients = []
- didids = []; gotemails = [] # Duplicate prevention.
# Who to notify:
#
@@ -370,7 +384,7 @@
# - Any supporters being removed from the issue by the current action
# We're liberal about duplicates - they'll be filtered before the send.
- candidates = [self.submitter_id] + self.assigned_to()
+ candidates = [self.submitter_id] + list(self.assigned_to())
if orig_status and not ('accepted' == string.lower(new_status) ==
string.lower(orig_status)):
candidates.extend(self.aq_parent.managers)
@@ -385,11 +399,24 @@
# manager is deassigning them).
candidates.extend(removals)
+ didids = []; gotemails = []
for userid in candidates:
if userid in didids:
+ # Cull duplicates.
continue
didids.append(userid)
name, email = util.get_email_fullname(self, userid)
+ if (userid == self.submitter_id) and self.submitter_email:
+ if self.submitter_email == email:
+ # Explicit one same as user preference - clear the
+ # explicit, so issue notification destination will track
+ # changes to the preference.
+ self.submitter_email = None
+ else:
+ # Explicitly specified email overrides user pref email.
+ email = self.submitter_email
+ if self.submitter_name:
+ name = self.submitter_name
if email:
if email in gotemails:
continue
@@ -654,6 +681,7 @@
description='',
submitter_id=None,
submitter_name=None,
+ submitter_email=None,
kibitzers=None,
topic=None,
classification=None,
@@ -673,6 +701,7 @@
description=description,
submitter_id=submitter_id,
submitter_name=submitter_name,
+ submitter_email=submitter_email,
kibitzers=kibitzers,
topic=topic,
classification=classification,