diff roundup/cgi_client.py @ 496:86943fdcca18

Oops, missed this before the beta: [SF#495392] empty nosy -patch
author Richard Jones <richard@users.sourceforge.net>
date Tue, 08 Jan 2002 03:56:55 +0000
parents a8fa8439afa7
children 2d9af3d5e0dd
line wrap: on
line diff
--- a/roundup/cgi_client.py	Tue Jan 08 02:37:13 2002 +0000
+++ b/roundup/cgi_client.py	Tue Jan 08 03:56:55 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: cgi_client.py,v 1.89 2002-01-07 20:24:45 richard Exp $
+# $Id: cgi_client.py,v 1.90 2002-01-08 03:56:55 richard Exp $
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
@@ -350,6 +350,18 @@
     showissue = shownode
     showmsg = shownode
 
+    def _add_assignedto_to_nosy(self, props):
+        ''' add the assignedto value from the props to the nosy list
+        '''
+        if not props.has_key('assignedto'):
+            return
+        assignedto_id = props['assignedto']
+        if props.has_key('nosy') and assignedto_id not in props['nosy']:
+            props['nosy'].append(assignedto_id)
+        else:
+            props['nosy'] = cl.get(self.nodeid, 'nosy')
+            props['nosy'].append(assignedto_id)
+
     def _changenode(self, props):
         ''' change the node based on the contents of the form
         '''
@@ -361,16 +373,21 @@
             resolved_id = self.db.status.lookup('resolved')
             chatting_id = self.db.status.lookup('chatting')
             current_status = cl.get(self.nodeid, 'status')
+            if props.has_key('status'):
+                new_status = props['status']
+            else:
+                # apparently there's a chance that some browsers don't
+                # send status...
+                new_status = current_status
         except KeyError:
             pass
         else:
-            if (props['status'] == unread_id or props['status'] == resolved_id and current_status == resolved_id):
+            if new_status == unread_id or (new_status == resolved_id
+                    and current_status == resolved_id):
                 props['status'] = chatting_id
-        # add assignedto to the nosy list
-        if props.has_key('assignedto'):
-            assignedto_id = props['assignedto']
-            if assignedto_id not in props['nosy']:
-                props['nosy'].append(assignedto_id)
+
+        self._add_assignedto_to_nosy(props)
+
         # create the message
         message, files = self._handle_message()
         if message:
@@ -395,13 +412,9 @@
                 pass
             else:
                 props['status'] = unread_id
-        # add assignedto to the nosy list
-        if props.has_key('assignedto'):
-            assignedto_id = props['assignedto']
-            if props.has_key('nosy') and assignedto_id not in props['nosy']:
-                props['nosy'].append(assignedto_id)
-            else:
-                props['nosy'] = [assignedto_id]
+
+        self._add_assignedto_to_nosy(props)
+
         # check for messages and files
         message, files = self._handle_message()
         if message:
@@ -1168,6 +1181,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.89  2002/01/07 20:24:45  richard
+# *mutter* stupid cutnpaste
+#
 # Revision 1.88  2002/01/02 02:31:38  richard
 # Sorry for the huge checkin message - I was only intending to implement #496356
 # but I found a number of places where things had been broken by transactions:

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