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
This commit is contained in:
Andy Botting 2019-06-12 13:58:37 +10:00
parent 43efb80725
commit 27483f3c65
1 changed files with 1 additions and 1 deletions

View File

@ -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)