From 7d6d1fba58531c0de81422ff13e8bc20d1117911 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 20 2015 09:23:48 +0000 Subject: Fix edit_issue_tags to actually add or not what needs to be (or don't) --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 95e283f..7d09b41 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -519,11 +519,15 @@ def edit_issue_tags(session, project, old_tag, new_tag, ticketfolder, user): for issue in set(issues): add = True # Drop the old tag - for issue_tag in issue.tags: + cnt = 0 + while cnt < len(issue.tags): + issue_tag = issue.tags[cnt] if issue_tag.tag == old_tag: issue.tags.remove(issue_tag) + cnt -= 1 if issue_tag.tag == new_tag: add = False + cnt += 1 session.flush() # Add the new one