Set housing.id only after retrieving phone if needed

This commit is contained in:
Gautier P 2021-01-18 11:21:22 +01:00
parent 89234b5c5b
commit caa4961679

View File

@ -235,14 +235,14 @@ class WebOOBProxy(object):
try: try:
housing = backend.get_housing(flat_id) housing = backend.get_housing(flat_id)
# Otherwise, we miss the @backend afterwards
housing.id = full_flat_id
if not store_personal_data: if not store_personal_data:
# Ensure phone is cleared # Ensure phone is cleared
housing.phone = None housing.phone = None
else: else:
# Ensure phone is fetched # Ensure phone is fetched
backend.fillobj(housing, 'phone') backend.fillobj(housing, 'phone')
# Otherwise, we miss the @backend afterwards
housing.id = full_flat_id
return json.dumps(housing, cls=WeboobEncoder) return json.dumps(housing, cls=WeboobEncoder)
except Exception as exc: # pylint: disable=broad-except except Exception as exc: # pylint: disable=broad-except