summaryrefslogtreecommitdiff
path: root/chimere/utils.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-01-31 15:48:57 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-01-31 15:48:57 +0100
commitfb64637f6579952516d2c4839fdd99df1e707ed4 (patch)
tree5884752fc4319dfdedef59c9fe0ffd5b792db8a9 /chimere/utils.py
parent600e2114ff29f1d87663bda0b300774ec3f5575b (diff)
downloadChimère-fb64637f6579952516d2c4839fdd99df1e707ed4.tar.bz2
Chimère-fb64637f6579952516d2c4839fdd99df1e707ed4.zip
Imports: make description import optional
Diffstat (limited to 'chimere/utils.py')
-rw-r--r--chimere/utils.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/chimere/utils.py b/chimere/utils.py
index fe1a8a1..c4e882b 100644
--- a/chimere/utils.py
+++ b/chimere/utils.py
@@ -241,6 +241,7 @@ class KMLManager(ImportManager):
pl_id = placemark.attrib.get('id')
pl_key = 'kml-%d' % self.importer_instance.pk
ns = '{%s}' % self.ns
+ description = ''
for item in placemark:
if item.tag == ns + 'name':
name = item.text
@@ -248,7 +249,8 @@ class KMLManager(ImportManager):
# if no ID is provided assume that name is a key
pl_id = name
elif item.tag == ns + 'description':
- description = item.text
+ if self.importer_instance.get_description:
+ description = item.text
elif item.tag == ns + 'Point':
for coord in item:
if coord.tag == ns + 'coordinates':
@@ -510,7 +512,10 @@ class CSVManager(ImportManager):
if len(row) < len(cols):
continue
pk, name, cats, state = row[0], row[1], row[2], row[3]
- description, geom = row[4], row[5]
+ geom = row[5]
+ description = ''
+ if self.importer_instance.get_description:
+ description = row[4]
COL_INDEX = 6
dct = {'description':description,
'name':name,
@@ -599,10 +604,11 @@ class GeoRSSManager(ImportManager):
y = item['geo_lat']
x = item['geo_long']
dct['point'] = 'SRID=4326;POINT(%s %s)' % (x, y)
- for k in ['description', 'summary', 'value']:
- if k in item:
- dct['description'] = item[k]
- break
+ if self.importer_instance.get_description:
+ for k in ['description', 'summary', 'value']:
+ if k in item:
+ dct['description'] = item[k]
+ break
else:
cls = Route
points = item['georss_line'].split(' ')