Skip to content

Commit 4138844

Browse files
author
Richard Jones
committed
Nosy list improvements.
. added option to automatically add the authors and recipients of messages to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current behaviour. Setting them to 'yes' will add the author/recipients to the nosy on messages that create issues and followup messages. . added missing documentation for a few of the config option values
1 parent 9bd649b commit 4138844

File tree

5 files changed

+381
-67
lines changed

5 files changed

+381
-67
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ Feature:
2222
. stripping of the email message body can now be controlled through the
2323
config variables EMAIL_KEEP_QUOTED_TEXT and EMAIL_LEAVE_BODY_UNCHANGED.
2424
. all database files created are now group readable and writable.
25+
. added option to automatically add the authors and recipients of messages
26+
to the nosy lists with the options ADD_AUTHOR_TO_NOSY (default 'new') and
27+
ADD_RECIPIENTS_TO_NOSY (default 'new'). These settings emulate the current
28+
behaviour. Setting them to 'yes' will add the author/recipients to the nosy
29+
on messages that create issues and followup messages.
2530

2631
Fixed:
2732
. stop sending blank (whitespace-only) notes
@@ -31,7 +36,7 @@ Fixed:
3136
to the nodes that are actually linked to in the "field" template
3237
function. This adds about 20+ seconds in the display of an issue if
3338
your database has a 1000 or more issues in it.
34-
39+
. added missing documentation for a few of the config option values
3540

3641
2002-03-25 - 0.4.1
3742
Feature:

roundup/mailgw.py

Lines changed: 65 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.67 2002-04-23 15:46:49 rochecompaan Exp $
76+
$Id: mailgw.py,v 1.68 2002-05-02 07:56:34 richard Exp $
7777
'''
7878

7979

@@ -131,7 +131,7 @@ def __init__(self, instance, db):
131131
def main(self, fp):
132132
''' fp - the file from which to read the Message.
133133
'''
134-
self.handle_Message(Message(fp))
134+
return self.handle_Message(Message(fp))
135135

136136
def handle_Message(self, message):
137137
'''Handle an RFC822 Message
@@ -493,7 +493,14 @@ def handle_message(self, message):
493493
r = recipient[1].strip().lower()
494494
if r == tracker_email or not r:
495495
continue
496-
recipients.append(self.db.uidFromAddress(recipient))
496+
497+
# look up the recipient - create if necessary (and we're
498+
# allowed to)
499+
recipient = self.db.uidFromAddress(recipient, create)
500+
501+
# if all's well, add the recipient to the list
502+
if recipient:
503+
recipients.append(recipient)
497504

498505
#
499506
# handle message-id and in-reply-to
@@ -638,25 +645,13 @@ def handle_message(self, message):
638645
current_status == resolved_id):
639646
props['status'] = chatting_id
640647

641-
# add nosy in arguments to issue's nosy list
642-
if not props.has_key('nosy'): props['nosy'] = []
643-
n = {}
648+
# update the nosy list
649+
current = {}
644650
for nid in cl.get(nodeid, 'nosy'):
645-
n[nid] = 1
646-
for value in props['nosy']:
647-
if self.db.hasnode('user', value):
648-
nid = value
649-
else:
650-
continue
651-
if n.has_key(nid): continue
652-
n[nid] = 1
653-
props['nosy'] = n.keys()
654-
# add assignedto to the nosy list
655-
if props.has_key('assignedto'):
656-
assignedto = props['assignedto']
657-
if assignedto not in props['nosy']:
658-
props['nosy'].append(assignedto)
651+
current[nid] = 1
652+
self.updateNosy(props, author, recipients, current)
659653

654+
# create the message
660655
message_id = self.db.msg.create(author=author,
661656
recipients=recipients, date=date.Date('.'), summary=summary,
662657
content=content, files=files, messageid=messageid,
@@ -711,30 +706,7 @@ def handle_message(self, message):
711706
props['messages'] = [message_id]
712707

713708
# set up (clean) the nosy list
714-
nosy = props.get('nosy', [])
715-
n = {}
716-
for value in nosy:
717-
nid = value
718-
if n.has_key(nid): continue
719-
n[nid] = 1
720-
props['nosy'] = n.keys()
721-
# add on the recipients of the message
722-
for recipient in recipients:
723-
if not n.has_key(recipient):
724-
props['nosy'].append(recipient)
725-
n[recipient] = 1
726-
727-
# add the author to the nosy list
728-
if not n.has_key(author):
729-
props['nosy'].append(author)
730-
n[author] = 1
731-
732-
# add assignedto to the nosy list
733-
if properties.has_key('assignedto') and props.has_key('assignedto'):
734-
assignedto = props['assignedto']
735-
if not n.has_key(assignedto):
736-
props['nosy'].append(assignedto)
737-
n[assignedto] = 1
709+
self.updateNosy(props, author, recipients)
738710

739711
# and attempt to create the new node
740712
try:
@@ -748,6 +720,50 @@ def handle_message(self, message):
748720
# commit the new node(s) to the DB
749721
self.db.commit()
750722

723+
return nodeid
724+
725+
def updateNosy(self, props, author, recipients, current=None):
726+
'''Determine what the nosy list should be given:
727+
728+
props: properties specified on the subject line of the message
729+
author: the sender of the message
730+
recipients: the recipients (to, cc) of the message
731+
current: if the issue already exists, this is the current nosy
732+
list, as a dictionary.
733+
'''
734+
if current is None:
735+
current = {}
736+
ok = ('new', 'yes')
737+
else:
738+
ok = ('yes',)
739+
740+
# add nosy in arguments to issue's nosy list
741+
nosy = props.get('nosy', [])
742+
for value in nosy:
743+
if not self.db.hasnode('user', value):
744+
continue
745+
if not current.has_key(value):
746+
current[value] = 1
747+
748+
# add the author to the nosy list
749+
if getattr(self.instance, 'ADD_AUTHOR_TO_NOSY', 'new') in ok:
750+
if not current.has_key(author):
751+
current[author] = 1
752+
753+
# add on the recipients of the message
754+
if getattr(self.instance, 'ADD_RECIPIENTS_TO_NOSY', 'new') in ok:
755+
for recipient in recipients:
756+
if not current.has_key(recipient):
757+
current[recipient] = 1
758+
759+
# add assignedto to the nosy list
760+
if props.has_key('assignedto'):
761+
assignedto = props['assignedto']
762+
if not current.has_key(assignedto):
763+
current[assignedto] = 1
764+
765+
props['nosy'] = current.keys()
766+
751767
def parseContent(content, keep_citations, keep_body,
752768
blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
753769
eol=re.compile(r'[\r\n]+'),
@@ -812,6 +828,11 @@ def parseContent(content, keep_citations, keep_body,
812828

813829
#
814830
# $Log: not supported by cvs2svn $
831+
# Revision 1.67 2002/04/23 15:46:49 rochecompaan
832+
# . stripping of the email message body can now be controlled through
833+
# the config variables EMAIL_KEEP_QUOTED_TEST and
834+
# EMAIL_LEAVE_BODY_UNCHANGED.
835+
#
815836
# Revision 1.66 2002/03/14 23:59:24 richard
816837
# . #517734 ] web header customisation is obscure
817838
#

roundup/templates/classic/instance_config.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: instance_config.py,v 1.14 2002-04-23 15:46:49 rochecompaan Exp $
18+
# $Id: instance_config.py,v 1.15 2002-05-02 07:56:34 richard Exp $
1919

2020
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
2121
HTTP_PORT=0
@@ -66,28 +66,40 @@
6666
LOG = os.path.join(INSTANCE_HOME, 'roundup.log')
6767

6868
# Where to place the web filtering HTML on the index page
69-
FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
69+
FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
7070

7171
# Deny or allow anonymous access to the web interface
72-
ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
72+
ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
7373

7474
# Deny or allow anonymous users to register through the web interface
75-
ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
75+
ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
7676

7777
# Deny or allow anonymous users to register through the mail interface
78-
ANONYMOUS_REGISTER_MAIL = 'deny' # either 'deny' or 'allow'
78+
ANONYMOUS_REGISTER_MAIL = 'deny' # either 'deny' or 'allow'
7979

8080
# Send nosy messages to the author of the message
81-
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
81+
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
82+
83+
# Does the author of a message get placed on the nosy list automatically?
84+
# If 'new' is used, then the author will only be added when a message
85+
# creates a new issue. If 'yes', then the author will be added on followups
86+
# too. If 'no', they're never added to the nosy.
87+
ADD_AUTHOR_TO_NOSY = 'new' # one of 'yes', 'no', 'new'
88+
89+
# Do the recipients (To:, Cc:) of a message get placed on the nosy list?
90+
# If 'new' is used, then the recipients will only be added when a message
91+
# creates a new issue. If 'yes', then the recipients will be added on followups
92+
# too. If 'no', they're never added to the nosy.
93+
ADD_RECIPIENTS_TO_NOSY = 'new' # either 'yes', 'no', 'new'
8294

8395
# Where to place the email signature
84-
EMAIL_SIGNATURE_POSITION = 'bottom'
96+
EMAIL_SIGNATURE_POSITION = 'bottom' # one of 'top', 'bottom', 'none'
8597

8698
# Keep email citations
87-
EMAIL_KEEP_QUOTED_TEXT = 'no'
99+
EMAIL_KEEP_QUOTED_TEXT = 'no' # either 'yes' or 'no'
88100

89101
# Preserve the email body as is
90-
EMAIL_LEAVE_BODY_UNCHANGED = 'no'
102+
EMAIL_LEAVE_BODY_UNCHANGED = 'no' # either 'yes' or 'no'
91103

92104
# Default class to use in the mailgw if one isn't supplied in email
93105
# subjects. To disable, comment out the variable below or leave it blank.
@@ -150,6 +162,11 @@
150162

151163
#
152164
# $Log: not supported by cvs2svn $
165+
# Revision 1.14 2002/04/23 15:46:49 rochecompaan
166+
# . stripping of the email message body can now be controlled through
167+
# the config variables EMAIL_KEEP_QUOTED_TEST and
168+
# EMAIL_LEAVE_BODY_UNCHANGED.
169+
#
153170
# Revision 1.13 2002/03/14 23:59:24 richard
154171
# . #517734 ] web header customisation is obscure
155172
#

roundup/templates/extended/instance_config.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: instance_config.py,v 1.14 2002-04-23 15:46:49 rochecompaan Exp $
18+
# $Id: instance_config.py,v 1.15 2002-05-02 07:56:34 richard Exp $
1919

2020
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
2121
HTTP_PORT=0
@@ -66,28 +66,40 @@
6666
LOG = os.path.join(INSTANCE_HOME, 'roundup.log')
6767

6868
# Where to place the web filtering HTML on the index page
69-
FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
69+
FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
7070

7171
# Deny or allow anonymous access to the web interface
72-
ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
72+
ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
7373

7474
# Deny or allow anonymous users to register through the web interface
75-
ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
75+
ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
7676

7777
# Deny or allow anonymous users to register through the mail interface
78-
ANONYMOUS_REGISTER_MAIL = 'deny' # either 'deny' or 'allow'
78+
ANONYMOUS_REGISTER_MAIL = 'deny' # either 'deny' or 'allow'
7979

8080
# Send nosy messages to the author of the message
81-
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
81+
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
82+
83+
# Does the author of a message get placed on the nosy list automatically?
84+
# If 'new' is used, then the author will only be added when a message
85+
# creates a new issue. If 'yes', then the author will be added on followups
86+
# too. If 'no', they're never added to the nosy.
87+
ADD_AUTHOR_TO_NOSY = 'new' # one of 'yes', 'no', 'new'
88+
89+
# Do the recipients (To:, Cc:) of a message get placed on the nosy list?
90+
# If 'new' is used, then the recipients will only be added when a message
91+
# creates a new issue. If 'yes', then the recipients will be added on followups
92+
# too. If 'no', they're never added to the nosy.
93+
ADD_RECIPIENTS_TO_NOSY = 'new' # either 'yes', 'no', 'new'
8294

8395
# Where to place the email signature
84-
EMAIL_SIGNATURE_POSITION = 'bottom'
96+
EMAIL_SIGNATURE_POSITION = 'bottom' # one of 'top', 'bottom', 'none'
8597

8698
# Keep email citations
87-
EMAIL_KEEP_QUOTED_TEXT = 'no'
99+
EMAIL_KEEP_QUOTED_TEXT = 'no' # either 'yes' or 'no'
88100

89101
# Preserve the email body as is
90-
EMAIL_LEAVE_BODY_UNCHANGED = 'no'
102+
EMAIL_LEAVE_BODY_UNCHANGED = 'no' # either 'yes' or 'no'
91103

92104
# Default class to use in the mailgw if one isn't supplied in email
93105
# subjects. To disable, comment out the variable below or leave it blank.
@@ -187,6 +199,11 @@
187199

188200
#
189201
# $Log: not supported by cvs2svn $
202+
# Revision 1.14 2002/04/23 15:46:49 rochecompaan
203+
# . stripping of the email message body can now be controlled through
204+
# the config variables EMAIL_KEEP_QUOTED_TEST and
205+
# EMAIL_LEAVE_BODY_UNCHANGED.
206+
#
190207
# Revision 1.13 2002/03/14 23:59:24 richard
191208
# . #517734 ] web header customisation is obscure
192209
#

0 commit comments

Comments
 (0)