mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user