ckan / ckanext-dcat

CKAN ♥ DCAT
163 stars 142 forks source link

probably a bug in plugins.py - after_show - set_titles #114

Closed thomasno closed 4 years ago

thomasno commented 6 years ago
            for key, value in object_dict.iteritems():
                if key in field_labels:
                    object_dict[field_labels[key]] = object_dict[key]
                    del object_dict[key]

The code above loops through a dictionary and makes changes to it, hence python raises "RuntimeError: dictionary changed size during iteration" Possible solution:

            loop_dict = object_dict.copy()
            for key, value in loop_dict.iteritems():
                if key in field_labels:
                    object_dict[field_labels[key]] = object_dict[key]
                    del object_dict[key]
frafra commented 4 years ago

I hit a RuntimeError: dictionary changed size during iteration error due to this code. I will propose a patch via pull request.