[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] Bug fix: check for wkt!=None in ocitysmap2/__in
From: |
David MENTRE |
Subject: |
[Maposmatic-dev] [PATCH] Bug fix: check for wkt!=None in ocitysmap2/__init__.py:_get_geographic_info() |
Date: |
Sun, 6 May 2012 16:16:41 +0200 |
In ocitysmap2/__init__.py:_get_geographic_info(), when one is looking in
the database, the returned "records" can be "[(None,)]". In that case
wkt obtains value None, which breaks the "shapely.wkt.loads(wkt)" call.
We add a protection against that.
Signed-off-by: David MENTRE <address@hidden>
---
ocitysmap2/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ocitysmap2/__init__.py b/ocitysmap2/__init__.py
index 2b0d084..e2c60df 100644
--- a/ocitysmap2/__init__.py
+++ b/ocitysmap2/__init__.py
@@ -327,6 +327,8 @@ SELECT ST_AsText(ST_LongestLine(
records = cursor.fetchall()
try:
((wkt,),) = records
+ if wkt is None:
+ raise ValueError
except ValueError:
raise LookupError("OSM ID %d not found in table %s" %
(osmid, table))
--
1.7.9.5
- [Maposmatic-dev] [PATCH] Bug fix: check for wkt!=None in ocitysmap2/__init__.py:_get_geographic_info(),
David MENTRE <=