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
This commit is contained in:
Carlos Cesar Caballero Díaz
2016-05-23 14:36:10 -04:00
parent d1889b922b
commit 47b1bf7323
+2 -2
View File
@@ -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