allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [allura] 14/16: [#8375] don't use a direct keys() view when mutating a dict in a loop
Date Thu, 27 Aug 2020 20:35:39 GMT
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/8375
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 833cbf0b4de8e0b42cf47fba7dc724521fc5d747
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Wed Aug 26 16:48:40 2020 -0400

    [#8375] don't use a direct keys() view when mutating a dict in a loop
---
 Allura/allura/lib/decorators.py           | 2 +-
 Allura/allura/model/neighborhood.py       | 2 +-
 ForgeTracker/forgetracker/tracker_main.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Allura/allura/lib/decorators.py b/Allura/allura/lib/decorators.py
index 7eaeb22..7197748 100644
--- a/Allura/allura/lib/decorators.py
+++ b/Allura/allura/lib/decorators.py
@@ -178,7 +178,7 @@ def memoize_cleanup(obj):
     """
     Remove any _memoize_dic_* keys (if obj is a dict/obj hybrid) that were created by @memoize
on methods
     """
-    for k in obj.keys():
+    for k in list(obj.keys()):
         if k.startswith('_memoize_dic'):
             del obj[k]
 
diff --git a/Allura/allura/model/neighborhood.py b/Allura/allura/model/neighborhood.py
index 74c18ac..33170fb 100644
--- a/Allura/allura/model/neighborhood.py
+++ b/Allura/allura/model/neighborhood.py
@@ -241,7 +241,7 @@ class Neighborhood(MappedClass):
     @staticmethod
     def compile_css_for_picker(css_form_dict):
         # Check css values
-        for key in css_form_dict.keys():
+        for key in list(css_form_dict.keys()):
             if ';' in css_form_dict[key] or '}' in css_form_dict[key]:
                 css_form_dict[key] = ''
 
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 3b116c9..7588ecc 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1707,7 +1707,7 @@ class TrackerAdminController(DefaultAdminController):
     @expose()
     @require_post()
     def allow_default_field(self, **post_data):
-        for column in self.app.globals['show_in_search'].keys():
+        for column in list(self.app.globals['show_in_search'].keys()):
             if post_data.get(column) == 'on':
                 self.app.globals['show_in_search'][column] = True
             else:


Mime
View raw message