From: olivier Date: Thu, 9 Jul 2009 11:41:58 +0000 (+0000) Subject: fix geo ethno historical names relations X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=802bd0f56d7cbcf48359d87d91ee43903a1f49fd;p=telemeta-data.git fix geo ethno historical names relations git-svn-id: http://svn.parisson.org/svn/crem@124 3bf09e05-f825-4182-b9bc-eedd7160adf0 --- diff --git a/trunk/import/migration/tasks/geoethno.py b/trunk/import/migration/tasks/geoethno.py index f22ac53..7caa6f5 100644 --- a/trunk/import/migration/tasks/geoethno.py +++ b/trunk/import/migration/tasks/geoethno.py @@ -107,6 +107,10 @@ class GeoEthnoImporter(DataMigrator): self.stats['historical names'] += self.replace("INSERT INTO locations "+ "(name, type, complete_type_id, current_name, is_authoritative) "+ "VALUES (%s, %s, %s, %s, %s)", (hname, short_type, type, name, 1)) + if (len(parentName)): + self.stats['relations'] += self.replace("INSERT INTO location_relations "+ + "(location_name, parent_location_name) "+ + "VALUE (%s, %s)", (hname, parentName)) def add_aliases(self, name, items): diff --git a/trunk/import/migration/tasks/items.py b/trunk/import/migration/tasks/items.py index 179e35e..e11492a 100644 --- a/trunk/import/migration/tasks/items.py +++ b/trunk/import/migration/tasks/items.py @@ -295,6 +295,7 @@ class ItemsLocationsMapper(DataMigrator): if location: if type == 'continent': self.stats['continent'] += 1 + self.warn("Unable to find GeoEthno country in sequence: %s" % str(sequence)) elif type == 'country': self.stats['country'] += 1 elif type == 'other': @@ -304,6 +305,7 @@ class ItemsLocationsMapper(DataMigrator): raise "Undetermined location type: %s" % type else: self.stats['nomap'] += 1 + #sys.stdout.write("nomap: %s\n" % str(unmatched)) comment = ", ".join(unmatched) self.target("UPDATE media_items SET location_name = %s, location_comment = %s WHERE old_code = %s",