Org deduplication fails with RuntimeError, Office dedup with IndexError
trendspotter opened this issue · comments
Jiří Podhorecký commented
Org deduplication
Steps to reproduce:
- Create an organization, fill in required values (name)
- Create another organization, fill in required values (name)
- Click on Mark as duplicate in both organizations, then on De-duplicate
- Select both organizations and click on Merge
- Click on either Keep original or Keep duplicate
- Merge will fail with
Could not merge records. (Internal Error: RuntimeError: dictionary changed size during iteration)
Underlying exception (not displayed, no ticket is created) is:
Traceback (most recent call last):
File "/srv/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/srv/web2py/applications/eden/controllers/org.py", line 511, in <module>
File "/srv/web2py/gluon/globals.py", line 429, in <lambda>
self._caller = lambda f: f()
File "/srv/web2py/applications/eden/controllers/org.py", line 175, in organisation
return s3db.org_organisation_controller()
File "/srv/web2py/applications/eden/modules/s3db/org.py", line 6877, in org_organisation_controller
output = current.rest_controller("org", "organisation",
File "/srv/web2py/applications/eden/models/00_utils.py", line 245, in s3_rest_controller
output = r(**attr)
File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 688, in __call__
output = handler(self, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 1775, in __call__
output = self.apply_method(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 91, in apply_method
output = self.duplicates(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 245, in duplicates
return self.merge(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 598, in merge
resource.merge(original[table._id],
File "/srv/web2py/applications/eden/modules/s3/s3resource.py", line 874, in merge
return S3RecordMerger(self).merge(original_id,
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 929, in merge
for tn in db._LAZY_TABLES.keys():
RuntimeError: dictionary changed size during iteration
The obvious solution would be to slap a .copy()
somewhere, but obvious != correct.
Office deduplication:
Steps to reproduce:
- Create an office, fill in required values (name, org)
- Create another office, fill in required values (name, org)
- Click on Mark as duplicate in both offices, then on De-duplicate
- Select both offices and click on Merge
Traceback (most recent call last):
File "/srv/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/srv/web2py/applications/eden/controllers/org.py", line 511, in <module>
File "/srv/web2py/gluon/globals.py", line 429, in <lambda>
self._caller = lambda f: f()
File "/srv/web2py/applications/eden/controllers/org.py", line 162, in office
return s3db.org_office_controller()
File "/srv/web2py/applications/eden/modules/s3db/org.py", line 7048, in org_office_controller
output = current.rest_controller("org", "office",
File "/srv/web2py/applications/eden/models/00_utils.py", line 245, in s3_rest_controller
output = r(**attr)
File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 688, in __call__
output = handler(self, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3rest.py", line 1775, in __call__
output = self.apply_method(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 91, in apply_method
output = self.duplicates(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 245, in duplicates
return self.merge(r, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 456, in merge
owidget = self.widget(f, original[f], _name=oid, _id=oid, _tabindex=index)
File "/srv/web2py/applications/eden/modules/s3/s3merge.py", line 737, in widget
inp = field.widget(field, value, **attr)
File "/srv/web2py/applications/eden/modules/s3/s3widgets.py", line 4876, in __call__
lx_rows = self._lx_selectors(field,
File "/srv/web2py/applications/eden/modules/s3/s3widgets.py", line 5439, in _lx_selectors
_fieldname = fieldname.split("%s_" % field.tablename)[1]
IndexError: list index out of range
Fran Boon commented
Then organisation one is a Py3 regression...will fix
I'll look at the office one too