From a20c4f6f2218255597c719aa7505295f689abf9a Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Wed, 22 Sep 2021 19:37:44 +0900 Subject: [PATCH] workflow: Do not touch dict during iteration Django 3.2 stored the field information as dict instead OrderedDict because python 3.7+ ensure the field order of dict as the language spec. We cannot touch dict itself during iteration. We need to pass a list instead of a value from .items() itself to avoid the error. Change-Id: Ie22865995d14fa60c16cf2cea582aa0eec46b65d Closes-Bug: #1944548 --- horizon/workflows/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py index 66f63006ff..4ceafaf9a6 100644 --- a/horizon/workflows/base.py +++ b/horizon/workflows/base.py @@ -169,7 +169,7 @@ class Action(forms.Form, metaclass=ActionMetaclass): return "<%s: %s>" % (self.__class__.__name__, self.slug) def _populate_choices(self, request, context): - for field_name, bound_field in self.fields.items(): + for field_name, bound_field in list(self.fields.items()): meth = getattr(self, "populate_%s_choices" % field_name, None) if meth is not None and callable(meth): bound_field.choices = meth(request, context)