Code

. made mailgw handle set and modify operations on multilinks (bug #579094)
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 10 Jul 2002 06:39:37 +0000 (06:39 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Wed, 10 Jul 2002 06:39:37 +0000 (06:39 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@860 57a73879-2fb5-44c3-a270-3262357dd7e2

CHANGES.txt
roundup/mailgw.py

index b5727225dd47d9a76c86e9419fac75bf8fc2f68c..466913438a0fd8e959f9a52660471346ee4187bb 100644 (file)
@@ -35,6 +35,7 @@ Feature:
    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
index ad9c10594e1aabf76365c9cf31997bc9d1c860a0..6ea92ffbfe2551fe5650f0fab3f05aa27bc31c5d 100644 (file)
@@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises
 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 @@ Subject was: "%s"
                         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 @@ Subject was: "%s"
                             item = item[1:]
                         elif item.startswith('+'):
                             item = item[1:]
+                        else:
+                            set = 1
 
                         # look up the value
                         try:
@@ -473,11 +481,16 @@ Subject was: "%s"
                                     '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 @@ def parseContent(content, keep_citations, keep_body,
 
 #
 # $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.