diff --git a/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py b/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py index 260441b..9a688f4 100644 --- a/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py +++ b/server/lib/python/cartodb_services/cartodb_services/here/bulk_geocoder.py @@ -93,7 +93,7 @@ class HereMapsBulkGeocoder(HereMapsGeocoder, StreetPointBulkGeocoder): for search in searches: fields = [search.address, search.city, search.state] search_text = ', '.join(filter(None, fields)) - row = [s.encode("utf-8") + row = [s.encode("utf-8") if s else '' for s in [str(search.id), search_text, search.country]] writer.writerow(row) diff --git a/test/integration/test_street_functions.py b/test/integration/test_street_functions.py index 1bf10cc..f4a83b2 100644 --- a/test/integration/test_street_functions.py +++ b/test/integration/test_street_functions.py @@ -233,6 +233,13 @@ class TestBulkStreetFunctions(TestStreetFunctionsSetUp): response = self._run_authenticated(query) assert_equal(n - 1, len(response['rows'])) + def test_missing_components_on_private_function(self): + query = "SELECT _cdb_bulk_geocode_street_point(" \ + " '[{\"id\": \"1\", \"address\": \"Amphitheatre Parkway 22\"}]' " \ + ")" + response = self._run_authenticated(query) + assert_equal(1, len(response['rows'])) + def _run_authenticated(self, query): authenticated_query = "{}&api_key={}".format(query, self.env_variables[