incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject git commit: [#5896] reverse sort the list we're del-iterating through, so the right idxs are deleted
Date Wed, 06 Mar 2013 18:53:55 GMT
Updated Branches:
  refs/heads/db/5896 fa9a8b21a -> 11ab05d77 (forced update)


[#5896] reverse sort the list we're del-iterating through, so the right idxs are deleted


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/11ab05d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/11ab05d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/11ab05d7

Branch: refs/heads/db/5896
Commit: 11ab05d7730c97202b2d291988b39f9d9be1fa5c
Parents: 31571da
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Wed Mar 6 17:23:44 2013 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Wed Mar 6 18:53:43 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   22 ++++++++++++++-
 ForgeTracker/forgetracker/widgets/ticket_form.py   |    2 +-
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/11ab05d7/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 3d038f9..950d33d 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -85,11 +85,31 @@ class TestMilestones(TrackerTestController):
             'milestones-0.due_date':''
         }
         self.app.post('/bugs/update_milestones', d)
+        d = {
+            'field_name':'_milestone',
+            'milestones-9.old_name':'',
+            'milestones-9.new_name':'3.0',
+            'milestones-9.description':'',
+            'milestones-9.complete':'Closed',
+            'milestones-9.due_date':''
+        }
+        self.app.post('/bugs/update_milestones', d)
+        d = {
+            'field_name':'_milestone',
+            'milestones-9.old_name':'',
+            'milestones-9.new_name':'4.0',
+            'milestones-9.description':'',
+            'milestones-9.complete':'Closed',
+            'milestones-9.due_date':''
+        }
+        self.app.post('/bugs/update_milestones', d)
         r = self.app.get('/bugs/1/')
         assert '<option selected value="1.0">1.0</option>' in r
         r = self.app.get('/bugs/new/')
-        assert  '<option value="2.0">2.0</option>' in r
+        assert '<option value="2.0">2.0</option>' in r
         assert '<option selected value="1.0">1.0</option>' not in r
+        assert '<option value="3.0">3.0</option>' not in r
+        assert '<option value="4.0">4.0</option>' not in r
 
 
 def post_install_create_ticket_permission(app):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/11ab05d7/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 25bd1bd..44bed56 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -34,7 +34,7 @@ class GenericTicketForm(ew.SimpleForm):
         ctx = self.context_for(field)
         if idx == '_milestone':
             milestone_value = ctx.value
-            for milestone in field.options:
+            for milestone in reversed(field.options):  # reverse so del hits the correct
indexes
                 if milestone.complete and (milestone.py_value != milestone_value):
                     del field.options[field.options.index(milestone)]
             ctx = self.context_for(field)


Mime
View raw message