[Tracker-discuss] [issue498] Don't reopen resolved issues when a comment is added

Ezio Melotti metatracker at psf.upfronthosting.co.za
Wed Jan 2 19:57:55 CET 2013


New submission from Ezio Melotti:

Attached patch does what the title says.

----------
assignedto: ezio.melotti
files: dontreopen.diff
messages: 2674
nosy: ezio.melotti
priority: wish
status: unread
title: Don't reopen resolved issues when a comment is added

_______________________________________________________
PSF Meta Tracker <metatracker at psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue498>
_______________________________________________________
-------------- next part --------------
diff --git a/detectors/statusauditor.py b/detectors/statusauditor.py
--- a/detectors/statusauditor.py
+++ b/detectors/statusauditor.py
@@ -21,11 +21,9 @@
 #$Id$
 
 def chatty(db, cl, nodeid, newvalues):
-    ''' If the issue is currently 'unread', 'resolved', 'done-cbb' or None,
-        then set it to 'chatting'
-    '''
+    """If the issue is currently 'unread' or None, then set it to 'chatting'"""
     # don't fire if there's no new message (ie. chat)
-    if not newvalues.has_key('messages'):
+    if 'messages' not in newvalues:
         return
     if newvalues['messages'] == cl.get(nodeid, 'messages'):
         return
@@ -41,17 +39,15 @@
     current_status = cl.get(nodeid, 'status')
 
     # see if there's an explicit change in this transaction
-    if newvalues.has_key('status'):
+    if 'status' in newvalues:
         # yep, skip
         return
 
-    # determine the id of 'unread', 'resolved' and 'chatting'
-    fromstates = []
-    for state in 'unread resolved done-cbb'.split():
-        try:
-            fromstates.append(db.status.lookup(state))
-        except KeyError:
-            pass
+    # determine the id of 'unread'
+    try:
+        fromstates.append(db.status.lookup('unread'))
+    except KeyError:
+        pass
 
     # ok, there's no explicit change, so check if we are in a state that
     # should be changed
@@ -61,9 +57,8 @@
 
 
 def presetunread(db, cl, nodeid, newvalues):
-    ''' Make sure the status is set on new issues
-    '''
-    if newvalues.has_key('status') and newvalues['status']:
+    """Make sure the status is set on new issues"""
+    if 'status' in newvalues and newvalues['status']:
         return
 
     # get the unread state ID


More information about the Tracker-discuss mailing list