changeset 847:0f0f6049c9a7

made mailgw handle set and modify operations on multilinks [SF#579094]
author Richard Jones <richard@users.sourceforge.net>
date Wed, 10 Jul 2002 06:39:37 +0000
parents 476afb5e7f52
children 2a928d404af8
files CHANGES.txt roundup/mailgw.py
diffstat 2 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Wed Jul 10 06:34:13 2002 +0000
+++ b/CHANGES.txt	Wed Jul 10 06:39:37 2002 +0000
@@ -35,6 +35,7 @@
    scraped from the web
  . added sorting of checklist HTML display
  . switched to using a session-based web login
+ . made mailgw handle set and modify operations on multilinks (bug #579094)
 
 
 2002-06-24 0.4.2
--- a/roundup/mailgw.py	Wed Jul 10 06:34:13 2002 +0000
+++ b/roundup/mailgw.py	Wed Jul 10 06:39:37 2002 +0000
@@ -73,7 +73,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
-$Id: mailgw.py,v 1.75 2002-07-09 01:21:24 richard Exp $
+$Id: mailgw.py,v 1.76 2002-07-10 06:39:37 richard Exp $
 '''
 
 
@@ -445,6 +445,12 @@
                         curvalue = []
 
                     # handle each add/remove in turn
+                    # keep an extra list for all items that are
+                    # definitely in the new list (in case of e.g.
+                    # <propname>=A,+B, which should replace the old
+                    # list with A,B)
+                    set = 0
+                    newvalue = []
                     for item in value.split(','):
                         item = item.strip()
 
@@ -455,6 +461,8 @@
                             item = item[1:]
                         elif item.startswith('+'):
                             item = item[1:]
+                        else:
+                            set = 1
 
                         # look up the value
                         try:
@@ -473,11 +481,16 @@
                                     'for %s.'%(item, propname))
                                 continue
                         else:
+                            newvalue.append(item)
                             if item not in curvalue:
                                 curvalue.append(item)
 
-                    # that's it, set the new Multilink property value
-                    props[propname] = curvalue
+                    # that's it, set the new Multilink property value,
+                    # or overwrite it completely
+                    if set:
+                        props[propname] = newvalue
+                    else:
+                        props[propname] = curvalue
 
             # handle any errors parsing the argument list
             if errors:
@@ -771,6 +784,10 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.75  2002/07/09 01:21:24  richard
+# Added ability for unit tests to turn off exception handling in mailgw so
+# that exceptions are reported earlier (and hence make sense).
+#
 # Revision 1.74  2002/05/29 01:16:17  richard
 # Sorry about this huge checkin! It's fixing a lot of related stuff in one go
 # though.

Roundup Issue Tracker: http://roundup-tracker.org/