Skip to content

Commit 2284ebd

Browse files
author
Richard Jones
committed
made mailgw handle set and modify operations on multilinks [SF#579094]
1 parent 9f42596 commit 2284ebd

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Feature:
3535
scraped from the web
3636
. added sorting of checklist HTML display
3737
. switched to using a session-based web login
38+
. made mailgw handle set and modify operations on multilinks (bug #579094)
3839

3940

4041
2002-06-24 0.4.2

roundup/mailgw.py

Lines changed: 20 additions & 3 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.75 2002-07-09 01:21:24 richard Exp $
76+
$Id: mailgw.py,v 1.76 2002-07-10 06:39:37 richard Exp $
7777
'''
7878

7979

@@ -445,6 +445,12 @@ def handle_message(self, message):
445445
curvalue = []
446446

447447
# handle each add/remove in turn
448+
# keep an extra list for all items that are
449+
# definitely in the new list (in case of e.g.
450+
# <propname>=A,+B, which should replace the old
451+
# list with A,B)
452+
set = 0
453+
newvalue = []
448454
for item in value.split(','):
449455
item = item.strip()
450456

@@ -455,6 +461,8 @@ def handle_message(self, message):
455461
item = item[1:]
456462
elif item.startswith('+'):
457463
item = item[1:]
464+
else:
465+
set = 1
458466

459467
# look up the value
460468
try:
@@ -473,11 +481,16 @@ def handle_message(self, message):
473481
'for %s.'%(item, propname))
474482
continue
475483
else:
484+
newvalue.append(item)
476485
if item not in curvalue:
477486
curvalue.append(item)
478487

479-
# that's it, set the new Multilink property value
480-
props[propname] = curvalue
488+
# that's it, set the new Multilink property value,
489+
# or overwrite it completely
490+
if set:
491+
props[propname] = newvalue
492+
else:
493+
props[propname] = curvalue
481494

482495
# handle any errors parsing the argument list
483496
if errors:
@@ -771,6 +784,10 @@ def parseContent(content, keep_citations, keep_body,
771784

772785
#
773786
# $Log: not supported by cvs2svn $
787+
# Revision 1.75 2002/07/09 01:21:24 richard
788+
# Added ability for unit tests to turn off exception handling in mailgw so
789+
# that exceptions are reported earlier (and hence make sense).
790+
#
774791
# Revision 1.74 2002/05/29 01:16:17 richard
775792
# Sorry about this huge checkin! It's fixing a lot of related stuff in one go
776793
# though.

0 commit comments

Comments
 (0)