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:
+2
-2
@@ -1711,8 +1711,8 @@ class SQLFORM(FORM):
|
|||||||
fields[fieldname] = self.vars[fieldname]
|
fields[fieldname] = self.vars[fieldname]
|
||||||
|
|
||||||
if dbio:
|
if dbio:
|
||||||
for fieldname in fields:
|
for fieldname in self.extra_fields:
|
||||||
if fieldname in self.extra_fields:
|
if fieldname in fields:
|
||||||
del fields[fieldname]
|
del fields[fieldname]
|
||||||
if 'delete_this_record' in fields:
|
if 'delete_this_record' in fields:
|
||||||
# this should never happen but seems to happen to some
|
# this should never happen but seems to happen to some
|
||||||
|
|||||||
Reference in New Issue
Block a user