From 3e1a8b735a9a19dfcd111f1e7932fe0cd7e3db86 Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Thu, 25 Sep 2014 15:25:22 +0200 Subject: [PATCH] [CapHousing] add and handle in leboncoin a new house type : UNKNOWN --- modules/leboncoin/backend.py | 3 ++- weboob/capabilities/housing.py | 11 +++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/modules/leboncoin/backend.py b/modules/leboncoin/backend.py index ff43efc322..108810ea4b 100644 --- a/modules/leboncoin/backend.py +++ b/modules/leboncoin/backend.py @@ -67,7 +67,8 @@ def search_housings(self, query): ret = [] for g in query.house_types: - ret.append(self.RET.get(g)) + if g in self.RET: + ret.append(self.RET.get(g)) if len(ret) == 0: return list() diff --git a/weboob/capabilities/housing.py b/weboob/capabilities/housing.py index f7da4f3839..41f8cd4fcb 100644 --- a/weboob/capabilities/housing.py +++ b/weboob/capabilities/housing.py @@ -85,7 +85,8 @@ def enum(**enums): HOUSE=u'House', PARKING=u'Parking', LAND=u'Land', - OTHER=u'Other') + OTHER=u'Other', + UNKNOWN=u'Unknown') type = IntField('Type of housing to find (TYPE_* constants)') cities = Field('List of cities to search in', list, tuple) @@ -94,13 +95,7 @@ def enum(**enums): cost_min = IntField('Minimal cost') cost_max = IntField('Maximal cost') nb_rooms = IntField('Number of rooms') - house_types = Field('List of house types', list, tuple) - - def __init__(self): - BaseObject.__init__(self, '') - self.house_types = [] - for value in self.HOUSE_TYPES.values: - self.house_types.append(value) + house_types = Field('List of house types', list, tuple, default=HOUSE_TYPES.values) class City(BaseObject): -- GitLab