correct bug when there is no society name
This commit is contained in:
parent
3010b662e3
commit
1df366598b
1 changed files with 6 additions and 2 deletions
|
|
@ -58,11 +58,15 @@ class AdvertPage(BasePage):
|
||||||
_id = self.parser.select(content, 'ul/li/ul/li/div[@class="value"]/span', 1, method='xpath').text
|
_id = self.parser.select(content, 'ul/li/ul/li/div[@class="value"]/span', 1, method='xpath').text
|
||||||
advert = PopolemploiJobAdvert(_id)
|
advert = PopolemploiJobAdvert(_id)
|
||||||
|
|
||||||
|
print url
|
||||||
advert.title = u'%s' % self.parser.select(content, 'h4', 1, method='xpath').text.strip()
|
advert.title = u'%s' % self.parser.select(content, 'h4', 1, method='xpath').text.strip()
|
||||||
advert.job_name = u'%s' % self.parser.select(content, 'h4', 1, method='xpath').text.strip()
|
advert.job_name = u'%s' % self.parser.select(content, 'h4', 1, method='xpath').text.strip()
|
||||||
advert.description = u'%s' % self.parser.select(content, 'p[@itemprop="description"]', 1, method='xpath').text
|
advert.description = u'%s' % self.parser.select(content, 'p[@itemprop="description"]', 1, method='xpath').text
|
||||||
advert.society_name = u'%s' % self.parser.select(content, 'div[@class="vcard"]/p[@class="title"]/span',
|
society_name = self.parser.select(content, 'div[@class="vcard"]/p[@class="title"]/span', method='xpath')
|
||||||
1, method='xpath').text
|
|
||||||
|
if society_name:
|
||||||
|
advert.society_name = u'%s' % society_name[0].text
|
||||||
|
|
||||||
advert.url = url
|
advert.url = url
|
||||||
advert.place = u'%s' % self.parser.select(content,
|
advert.place = u'%s' % self.parser.select(content,
|
||||||
'ul/li/div[@class="value"]/ul/li[@itemprop="addressRegion"]',
|
'ul/li/div[@class="value"]/ul/li[@itemprop="addressRegion"]',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue