Fix modules
This commit is contained in:
parent
e284a71a43
commit
28270a15b9
@ -49,6 +49,8 @@ class HousingPage(HTMLPage):
|
|||||||
@method
|
@method
|
||||||
class iter_housings(ListElement):
|
class iter_housings(ListElement):
|
||||||
item_xpath = '//div[has-class("search-list-item-alt")]'
|
item_xpath = '//div[has-class("search-list-item-alt")]'
|
||||||
|
# Prevent DataError on same ids
|
||||||
|
ignore_duplicate = True
|
||||||
|
|
||||||
def next_page(self):
|
def next_page(self):
|
||||||
return Link('//ul[@class="pagination"]/li[@class="next"]/a')(self)
|
return Link('//ul[@class="pagination"]/li[@class="next"]/a')(self)
|
||||||
@ -61,6 +63,9 @@ class HousingPage(HTMLPage):
|
|||||||
isNotFurnishedOk = True
|
isNotFurnishedOk = True
|
||||||
if self.env['query_type'] == POSTS_TYPES.RENT:
|
if self.env['query_type'] == POSTS_TYPES.RENT:
|
||||||
isNotFurnishedOk = 'meublé' not in title.lower()
|
isNotFurnishedOk = 'meublé' not in title.lower()
|
||||||
|
id = self.obj_id(self)
|
||||||
|
if id is None:
|
||||||
|
return False
|
||||||
return (
|
return (
|
||||||
Regexp(Link('./div/a[has-class("item-title")]'), '/annonces/(.*)', default=None)(self) and
|
Regexp(Link('./div/a[has-class("item-title")]'), '/annonces/(.*)', default=None)(self) and
|
||||||
isNotFurnishedOk
|
isNotFurnishedOk
|
||||||
@ -94,7 +99,11 @@ class HousingPage(HTMLPage):
|
|||||||
)(item)
|
)(item)
|
||||||
self.env[name] = value
|
self.env[name] = value
|
||||||
|
|
||||||
obj_id = Regexp(Link('./div/a[has-class("item-title")]'), '/annonces/(.*)')
|
obj_id = Regexp(
|
||||||
|
Link('./div/a[has-class("item-title")]'), '/annonces/(.*)',
|
||||||
|
default=None
|
||||||
|
)
|
||||||
|
|
||||||
obj_type = Env('query_type')
|
obj_type = Env('query_type')
|
||||||
obj_advert_type = ADVERT_TYPES.PERSONAL
|
obj_advert_type = ADVERT_TYPES.PERSONAL
|
||||||
|
|
||||||
|
@ -81,7 +81,11 @@ class SearchResultsPage(HTMLPage):
|
|||||||
klass = Housing
|
klass = Housing
|
||||||
|
|
||||||
def condition(self):
|
def condition(self):
|
||||||
return Dict('cardType')(self) not in ['advertising', 'localExpert'] and Dict('id', default=False)(self)
|
return (
|
||||||
|
Dict('cardType')(self) not in ['advertising', 'localExpert']
|
||||||
|
and Dict('id', default=False)(self)
|
||||||
|
and Dict('classifiedURL', default=False)(self)
|
||||||
|
)
|
||||||
|
|
||||||
obj_id = Dict('id')
|
obj_id = Dict('id')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user