]> git.parisson.com Git - telemeta-data.git/commitdiff
fix geo ethno historical names relations
authorolivier <olivier@3bf09e05-f825-4182-b9bc-eedd7160adf0>
Thu, 9 Jul 2009 11:41:58 +0000 (11:41 +0000)
committerolivier <olivier@3bf09e05-f825-4182-b9bc-eedd7160adf0>
Thu, 9 Jul 2009 11:41:58 +0000 (11:41 +0000)
git-svn-id: http://svn.parisson.org/svn/crem@124 3bf09e05-f825-4182-b9bc-eedd7160adf0

trunk/import/migration/tasks/geoethno.py
trunk/import/migration/tasks/items.py

index f22ac5343264f718418ad95a9a5c930edd6910c3..7caa6f58d63e610f3a0925b41e95ba1928b9ebf6 100644 (file)
@@ -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):
index 179e35e15fd4c6df38815c26bbed3101780d1a0e..e11492ae1b1e6b96dbc5f6d5425868efc8032b1b 100644 (file)
@@ -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",