[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/
Date: Sun, 6 May 2012 16:16:41 +0200

In ocitysmap2/, 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/ |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/ocitysmap2/ b/ocitysmap2/
index 2b0d084..e2c60df 100644
--- a/ocitysmap2/
+++ b/ocitysmap2/
@@ -327,6 +327,8 @@ SELECT ST_AsText(ST_LongestLine(
         records = cursor.fetchall()
             ((wkt,),) = records
+            if wkt is None:
+                raise ValueError
         except ValueError:
             raise LookupError("OSM ID %d not found in table %s" %
                               (osmid, table))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]