make sure PHP and Python reverse code does the same

The only allowable difference is precision of coordinates. Python uses
a precision of 7 digits where possible, which corresponds to the
precision of OSM data.

Also fixes some smaller bugs found by the BDD tests.
This commit is contained in:
Sarah Hoffmann
2023-03-26 12:22:34 +02:00
parent 300921a93e
commit 86b43dc605
20 changed files with 235 additions and 162 deletions

View File

@@ -10,7 +10,6 @@ Server implementation using the falcon webserver framework.
from typing import Optional, Mapping, cast, Any
from pathlib import Path
import falcon
from falcon.asgi import App, Request, Response
from nominatim.api import NominatimAPIAsync
@@ -26,9 +25,12 @@ class HTTPNominatimError(Exception):
self.content_type = content_type
async def nominatim_error_handler(req: Request, resp: Response,
async def nominatim_error_handler(req: Request, resp: Response, #pylint: disable=unused-argument
exception: HTTPNominatimError,
_: Any) -> None:
""" Special error handler that passes message and content type as
per exception info.
"""
resp.status = exception.status
resp.text = exception.msg
resp.content_type = exception.content_type

View File

@@ -36,7 +36,6 @@ class ParamWrapper(api_impl.ASGIAdaptor):
def error(self, msg: str, status: int = 400) -> SanicException:
exception = SanicException(msg, status_code=status)
exception.headers = {'content-type': self.content_type}
return exception