[Python-checkins] r71982 - tracker/instances/python-dev/detectors/statusauditor.py

martin.v.loewis python-checkins at python.org
Sun Apr 26 22:24:01 CEST 2009


Author: martin.v.loewis
Date: Sun Apr 26 22:24:01 2009
New Revision: 71982

Log:
Issue #256: Refuse to close an issue if there are open
dependencies.


Modified:
   tracker/instances/python-dev/detectors/statusauditor.py

Modified: tracker/instances/python-dev/detectors/statusauditor.py
==============================================================================
--- tracker/instances/python-dev/detectors/statusauditor.py	(original)
+++ tracker/instances/python-dev/detectors/statusauditor.py	Sun Apr 26 22:24:01 2009
@@ -17,7 +17,12 @@
         dependencies = cl.get(nodeid, 'dependencies')
     dependencies = newvalues.get('dependencies', dependencies)
 
-    # don't do anything if there's no blockers or the status hasn't
+    # Check which dependencies are still open
+    closed = db.status.lookup('closed')
+    dep = [nid for nid in dependencies if cl.get(nid,'status') != closed]
+    dependencies = dep
+
+    # don't do anything if there's no open blockers or the status hasn't
     # changed
     if not dependencies or not newvalues.has_key('status'):
         return
@@ -31,7 +36,7 @@
         s = 'issues %s are'%s
 
     # ok, see if we're trying to resolve
-    if newvalues.get('status') and newvalues['status'] == db.status.lookup('closed'):
+    if newvalues.get('status') and newvalues['status'] == closed:
         raise ValueError, "This issue can't be closed until %s closed."%s
 
 
@@ -88,7 +93,7 @@
     # fire before changes are made
     db.issue.audit('create', init_status)
 #    db.issue.audit('create', block_resolution)
-#    db.issue.audit('set', block_resolution)
+    db.issue.audit('set', block_resolution)
 #    db.issue.audit('set', resolve)
 
     # adjust after changes are committed


More information about the Python-checkins mailing list