X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8f299838f756045e2340a38d56a5dfe99d3f6196..bd2c64876f7ddc99da14ea78a652f797e17134f4:/nominatim/api/types.py diff --git a/nominatim/api/types.py b/nominatim/api/types.py index 3579d7fa..87568a09 100644 --- a/nominatim/api/types.py +++ b/nominatim/api/types.py @@ -302,10 +302,11 @@ def format_excluded(ids: Any) -> List[int]: else: raise UsageError("Parameter 'excluded' needs to be a comma-separated list " "or a Python list of numbers.") - if not all(isinstance(i, int) or (isinstance(i, str) and i.isdigit()) for i in plist): + if not all(isinstance(i, int) or + (isinstance(i, str) and (not i or i.isdigit())) for i in plist): raise UsageError("Parameter 'excluded' only takes place IDs.") - return [int(id) for id in plist if id] + return [int(id) for id in plist if id] or [0] def format_categories(categories: List[Tuple[str, str]]) -> List[Tuple[str, str]]: @@ -400,7 +401,8 @@ class SearchDetails(LookupDetails): ) """ Highest address rank to return. """ - layers: Optional[DataLayer] = None + layers: Optional[DataLayer] = dataclasses.field(default=None, + metadata={'transform': lambda r : r}) """ Filter which kind of data to include. When 'None' (the default) then filtering by layers is disabled. """ @@ -427,7 +429,8 @@ class SearchDetails(LookupDetails): metadata={'transform': Point.from_param}) """ Order results by distance to the given point. """ - near_radius: Optional[float] = None + near_radius: Optional[float] = dataclasses.field(default=None, + metadata={'transform': lambda r : r}) """ Use near point as a filter and drop results outside the given radius. Radius is given in degrees WSG84. """