Add missing unicode() calls to avoid ConversionWarning reports
Signed-off-by: Damien Cassou <damien.cassou@gmail.com> Signed-off-by: Romain Bignon <romain@symlink.me>
This commit is contained in:
parent
fbdf44e27a
commit
0a83341849
4 changed files with 15 additions and 15 deletions
|
|
@ -60,7 +60,7 @@ class PapBackend(BaseBackend, ICapHousing):
|
|||
with self.browser:
|
||||
for city in self.browser.search_geo(pattern):
|
||||
c = City(city['id'])
|
||||
c.name = city['name']
|
||||
c.name = unicode(city['name'])
|
||||
yield c
|
||||
|
||||
def fill_housing(self, housing, fields):
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class SearchResultsPage(BasePage):
|
|||
|
||||
metro = div.cssselect('p.metro')
|
||||
if len(metro) > 0:
|
||||
housing.station = metro[0].text.strip()
|
||||
housing.station = unicode(metro[0].text.strip())
|
||||
else:
|
||||
housing.station = NotAvailable
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ class SearchResultsPage(BasePage):
|
|||
b = p.findall('b')
|
||||
if len(b) > 0:
|
||||
housing.text = b[0].tail.strip()
|
||||
housing.location = b[0].text
|
||||
housing.location = unicode(b[0].text)
|
||||
else:
|
||||
housing.text = p.text.strip()
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class HousingPage(BasePage):
|
|||
b = p.findall('b')
|
||||
if len(b) > 0:
|
||||
housing.text = b[0].tail.strip()
|
||||
housing.location = b[0].text
|
||||
housing.location = unicode(b[0].text)
|
||||
if len(b) > 1:
|
||||
housing.phone = b[1].text
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class SeLogerBackend(BaseBackend, ICapHousing):
|
|||
if not 'value' in city:
|
||||
continue
|
||||
c = City(city['value'])
|
||||
c.name = city['label']
|
||||
c.name = unicode(city['label'])
|
||||
yield c
|
||||
|
||||
def fill_housing(self, housing, fields):
|
||||
|
|
|
|||
|
|
@ -40,21 +40,21 @@ class SearchResultsPage(BasePage):
|
|||
def iter_housings(self):
|
||||
for a in self.document.getroot().xpath('//annonce'):
|
||||
housing = Housing(a.find('idannonce').text)
|
||||
housing.title = a.find('titre').text
|
||||
housing.title = unicode(a.find('titre').text)
|
||||
housing.date = parse_date(a.find('dtfraicheur').text)
|
||||
housing.cost = Decimal(a.find('prix').text)
|
||||
housing.currency = u'€'
|
||||
housing.area = Decimal(a.find('surface').text)
|
||||
housing.text = a.find('descriptif').text.strip()
|
||||
housing.location = a.find('ville').text
|
||||
housing.text = unicode(a.find('descriptif').text.strip())
|
||||
housing.location = unicode(a.find('ville').text)
|
||||
try:
|
||||
housing.station = a.find('proximite').text
|
||||
housing.station = unicode(a.find('proximite').text)
|
||||
except AttributeError:
|
||||
housing.station = NotAvailable
|
||||
|
||||
housing.photos = []
|
||||
for photo in a.xpath('./photos/photo'):
|
||||
url = photo.find('stdurl').text
|
||||
url = unicode(photo.find('stdurl').text)
|
||||
housing.photos.append(HousingPhoto(url))
|
||||
|
||||
yield housing
|
||||
|
|
@ -68,22 +68,22 @@ class HousingPage(BasePage):
|
|||
if details.find('titre') is None:
|
||||
return None
|
||||
|
||||
housing.title = details.find('titre').text
|
||||
housing.title = unicode(details.find('titre').text)
|
||||
housing.text = details.find('descriptif').text.strip()
|
||||
housing.cost = Decimal(details.find('prix').text)
|
||||
housing.currency = u'€'
|
||||
housing.date = parse_date(details.find('dtfraicheur').text)
|
||||
housing.area = Decimal(details.find('surface').text)
|
||||
housing.phone = details.find('contact').find('telephone').text
|
||||
housing.phone = unicode(details.find('contact').find('telephone').text)
|
||||
|
||||
try:
|
||||
housing.station = details.find('proximite').text
|
||||
housing.station = unicode(details.find('proximite').text)
|
||||
except AttributeError:
|
||||
housing.station = NotAvailable
|
||||
|
||||
housing.location = details.find('adresse').text
|
||||
if not housing.location and details.find('quartier') is not None:
|
||||
housing.location = details.find('quartier').text
|
||||
housing.location = unicode(details.find('quartier').text)
|
||||
if not housing.location:
|
||||
housing.location = NotAvailable
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ class HousingPage(BasePage):
|
|||
url = photo.find('bigurl').text
|
||||
else:
|
||||
url = photo.find('stdurl').text
|
||||
housing.photos.append(HousingPhoto(url))
|
||||
housing.photos.append(HousingPhoto(unicode(url)))
|
||||
|
||||
housing.details = {}
|
||||
for detail in details.xpath('./details/detail'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue