From 47b1bf7323cc308a40b10712c166cb57891626c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Cesar=20Caballero=20D=C3=ADaz?= Date: Mon, 23 May 2016 14:36:10 -0400 Subject: [PATCH] fixing dictionary changed size error on SQLFORM using extra_fields When uses the extra_fields keyword argument in SQLFORM rises an "RuntimeError: dictionary changed size during iteration" exception because is trying to remove a dictionary element while is iterating the dict --- gluon/sqlhtml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index f0d2b0ed..513d451c 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -1711,8 +1711,8 @@ class SQLFORM(FORM): fields[fieldname] = self.vars[fieldname] if dbio: - for fieldname in fields: - if fieldname in self.extra_fields: + for fieldname in self.extra_fields: + if fieldname in fields: del fields[fieldname] if 'delete_this_record' in fields: # this should never happen but seems to happen to some