From 27483f3c65dadfb9ca693809ca3cca6f80a0c800 Mon Sep 17 00:00:00 2001 From: Andy Botting Date: Wed, 12 Jun 2019 13:58:37 +1000 Subject: [PATCH] Fix dictionary changed size during iteration error with Python 3 In Python 2, dict.keys() would return a copy of the keys as a list which could be modified. In Python 3 it is returned as an iterator which can't be modified, so simply cast it as a list. Change-Id: I0c955337b689ad2cbdb3975ca4f1ddd52e277a70 --- muranodashboard/catalog/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/muranodashboard/catalog/views.py b/muranodashboard/catalog/views.py index d700e0bb3..5c01e4333 100644 --- a/muranodashboard/catalog/views.py +++ b/muranodashboard/catalog/views.py @@ -212,7 +212,7 @@ def clear_forms_data(func): LOG.debug('Clearing forms data for application {0}.'.format(fqn)) services.get_apps_data(request)[app_id] = {} LOG.debug('Clearing any leftover wizard step data.') - for key in request.session.keys(): + for key in list(request.session.keys()): # TODO(tsufiev): unhardcode the prefix for wizard step data if key.startswith('wizard_wizard'): request.session.pop(key)