Skip to content
This repository
Browse code

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 authored December 22, 2010

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. 3  molly/providers/apps/maps/oxpoints.py
3  molly/providers/apps/maps/oxpoints.py
@@ -120,6 +120,9 @@ def import_data(self, metadata, output):
120 120
                 entity = Entity.objects.get(source=source, _identifiers__scheme='oxpoints', _identifiers__value=oxpoints_id)
121 121
             except Entity.DoesNotExist:
122 122
                 entity = Entity(source=source)
  123
+            except Entity.MultipleObjectsReturned:
  124
+                Entity.objects.filter(source=source, _identifiers__scheme='oxpoints', _identifiers__value=oxpoints_id).delete()
  125
+                entity = Entity(source=source)
123 126
 
124 127
             entity.title = datum.get('oxp_fullyQualifiedTitle', datum.get('dc_title', ''))
125 128
             entity.primary_type = self.entity_types[self.OXPOINTS_TYPES[oxpoints_type][0]]

0 notes on commit cc28bf6

Please sign in to comment.
Something went wrong with that request. Please try again.