Code

Oops, missed this before the beta:
[roundup.git] / roundup / cgi_client.py
index 30c040346482f56280d2b669eae0721fc8772116..86177bb6b257e0978b35d5d4970cb982d5e404f7 100644 (file)
@@ -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 @@ class Client:
     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 @@ class Client:
             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 @@ class Client:
                 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 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
 
 #
 # $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: