Removed an unnecessary conditional from get_block_geometry_as_wkt().
cursor.execute(query, sql_params)
rows = cursor.fetchall()
cursor.close()
-
- if len(rows) > 0:
+
+ # SQL queries that return no results get returned as [[None]].
+ if rows[0][0] != None:
return rows[0][0]
else:
- return None
+ return 0
def find_contained_population(self, well_known_text):
rows = cursor.fetchall()
cursor.close()
- if (len(rows) > 0):
+ # SQL queries that return no results get returned as [[None]].
+ if rows[0][0] != None:
return rows[0][0]
else:
- return None
+ return 0
rows = cursor.fetchall()
cursor.close()
- if len(rows) > 0:
- return rows[0][0]
- else:
- return None
+ # Just pass on the None if that's what we got from the
+ # database.
+ return rows[0][0]