comparison flys-backend/contrib/shpimporter/importer.py @ 4877:852d4c508f33

(importer) Try to convert paths to UTF-8 for DB insertion
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Jan 2013 10:44:58 +0100
parents 884afa149192
children 82d00b0c7302
comparison
equal deleted inserted replaced
4876:884afa149192 4877:852d4c508f33
2 from osgeo import ogr 2 from osgeo import ogr
3 except ImportErrror: 3 except ImportErrror:
4 import ogr 4 import ogr
5 import osr 5 import osr
6 import shpimporter 6 import shpimporter
7 import utils
7 8
8 class Importer: 9 class Importer:
9 10
10 def __init__(self, config, dbconn): 11 def __init__(self, config, dbconn):
11 self.config = config 12 self.config = config
112 feat, 113 feat,
113 name=name, 114 name=name,
114 path=path) 115 path=path)
115 116
116 if newFeat is not None: 117 if newFeat is not None:
117 newFeat.SetField("path", path) 118 newFeat.SetField("path", utils.getUTF8Path(path))
118 newFeat = self.transform(newFeat) 119 newFeat = self.transform(newFeat)
119 res = destLayer.CreateFeature(newFeat) 120 res = destLayer.CreateFeature(newFeat)
120 if res is None or res > 0: 121 if res is None or res > 0:
121 shpimporter.ERROR("Unable to insert feature. Error: %r" % res) 122 shpimporter.ERROR("Unable to insert feature. Error: %r" % res)
122 else: 123 else:

http://dive4elements.wald.intevation.org