Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix issue where some Oxpoints data is duplicated - if this happens, d…

…elete the offending entity and reimport in the importer
  • Loading branch information...
commit cc28bf6b46c64da9b7e15b8d28c16d1f86cbc423 1 parent 78509d0
Chris Northwood cnorthwood authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  molly/providers/apps/maps/oxpoints.py
3  molly/providers/apps/maps/oxpoints.py
View
@@ -120,6 +120,9 @@ def import_data(self, metadata, output):
entity = Entity.objects.get(source=source, _identifiers__scheme='oxpoints', _identifiers__value=oxpoints_id)
except Entity.DoesNotExist:
entity = Entity(source=source)
+ except Entity.MultipleObjectsReturned:
+ Entity.objects.filter(source=source, _identifiers__scheme='oxpoints', _identifiers__value=oxpoints_id).delete()
+ entity = Entity(source=source)
entity.title = datum.get('oxp_fullyQualifiedTitle', datum.get('dc_title', ''))
entity.primary_type = self.entity_types[self.OXPOINTS_TYPES[oxpoints_type][0]]
Please sign in to comment.
Something went wrong with that request. Please try again.