Commit 826989f7 authored by Phyks's avatar Phyks

Monkey patch a WebOOB bug: No long waiting for the flats to be fetched!

When passing a `Query` to a WebOOB backend and the query has no cities
for this backend, WebOOB was returning nonsense. This is now solved as
we only call the relevant backends for each query.
parent cc9ed3d3
Pipeline #64091 failed with stage
in 4 minutes and 10 seconds
......@@ -185,10 +185,20 @@ class WebOOBProxy(object):
:return: The matching housing posts, dumped as a list of JSON objects.
"""
housings = []
# List the useful backends for this specific query
useful_backends = [x.backend for x in query.cities]
# TODO: Handle max_entries better
try:
for housing in itertools.islice(
self.webnip.do('search_housings', query),
self.webnip.do(
'search_housings',
query,
# Only run the call on the required backends.
# Otherwise, WebOOB is doing weird stuff and returning
# nonsense.
backends=[x for x in self.backends
if x.name in useful_backends]
),
max_entries
):
if not store_personal_data:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment