diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2015-02-12 10:52:55 +0100 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2015-02-12 10:52:55 +0100 |
| commit | f6db77d81ea87d99462b4c3cc40a8a27e0264724 (patch) | |
| tree | b26fb71a62082aeec81c7bb1bb3d7447d006aed3 /searx/engines/openstreetmap.py | |
| parent | 516105c570a920dadeb87b34ee5ee434ad5cb16f (diff) | |
| parent | f96154b7c454a3b02bf688f248b4471c2020c28f (diff) | |
Merge pull request #210 from Cqoicebordel/unit-tests
unit tests
Diffstat (limited to 'searx/engines/openstreetmap.py')
| -rw-r--r-- | searx/engines/openstreetmap.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py index 68446ef5f..60c3c13ca 100644 --- a/searx/engines/openstreetmap.py +++ b/searx/engines/openstreetmap.py @@ -38,6 +38,9 @@ def response(resp): # parse results for r in json: + if 'display_name' not in r: + continue + title = r['display_name'] osm_type = r.get('osm_type', r.get('type')) url = result_base_url.format(osm_type=osm_type, @@ -49,10 +52,8 @@ def response(resp): geojson = r.get('geojson') # if no geojson is found and osm_type is a node, add geojson Point - if not geojson and\ - osm_type == 'node': - geojson = {u'type': u'Point', - u'coordinates': [r['lon'], r['lat']]} + if not geojson and osm_type == 'node': + geojson = {u'type': u'Point', u'coordinates': [r['lon'], r['lat']]} address_raw = r.get('address') address = {} |