From 2f348b624d40230794d5eaefc14cc85e93fbf68b Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 16:58:11 +0300 Subject: =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=20=D0=B1=D0=B0=D0=B3=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20merge?= =?UTF-8?q?=20pull-request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- habr/topic.py | 12 ++++++++---- requirements.txt | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/habr/topic.py b/habr/topic.py index fdf56f9..d83d8e4 100644 --- a/habr/topic.py +++ b/habr/topic.py @@ -50,12 +50,16 @@ class TMTopic(object): if len(post_title) == 0: raise PostDeleted self.post['title'] = post_title - tmp = doc.xpath("//div[@class='author-info__username']//a[@class='author-info__nickname']") or \ - doc.xpath("//div[@class='author-info__username']//a[@class='author-info__name']") or \ - doc.xpath("//div[@class='author-info__username']//span[@class='author-info__name']") + tmp = \ + doc.xpath("//div[@class='author-info__username']//a[@class='author-info__nickname']") or \ + doc.xpath("//div[@class='author-info__username']//a[@class='author-info__name']") or \ + doc.xpath("//div[@class='author-info__username']//span[@class='author-info__name']") if len(tmp): - self.post['author_url'] = ('https://' + self.domain + tmp[0].attrib['href'] ) self.post['author'] = tmp[0].text + if tmp[0].attrib.get('href'): + self.post['author_url'] = ('https://' + self.domain + tmp[0].attrib['href'] ) + else: + self.post['author_url'] = "https://{}/users/{}".format(self.domain, self.post['author']) else: self.post['author_url']= '' self.post['author'] = '' diff --git a/requirements.txt b/requirements.txt index 83aed1c..5248704 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,5 +11,5 @@ Pyphen==0.9.4 requests==2.12.3 six==1.10.0 tinycss==0.4 -WeasyPrint>=0.34 +WeasyPrint>=0.33 webencodings==0.5 -- cgit v1.2.3 From 2d907ee7938c7c7e557f89fb7fdc39f087e52546 Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 17:06:43 +0300 Subject: fix for requrements.txt and added python3.6 to .travis.yml --- .travis.yml | 1 + requirements.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index f0a0253..110f781 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ python: - "3.3" - "3.4" - "3.5" + - "3.6" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/requirements.txt b/requirements.txt index 5248704..4b1078e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,4 @@ six==1.10.0 tinycss==0.4 WeasyPrint>=0.33 webencodings==0.5 +six \ No newline at end of file -- cgit v1.2.3 From 33704a98bac6d23aa30a1cf954ff9efe4d411e76 Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 17:42:57 +0300 Subject: fix requrements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4b1078e..5248704 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,3 @@ six==1.10.0 tinycss==0.4 WeasyPrint>=0.33 webencodings==0.5 -six \ No newline at end of file -- cgit v1.2.3 From 7da2de43251ccb3783aff1f13beac76c4aeee474 Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 18:02:44 +0300 Subject: another fix for requirements.txt --- requirements.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5248704..7d3c6a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ +six>=1.10.0 cairocffi>=0.7.2 CairoSVG>=2.0.0 -cffi==1.9.1 -cssselect==1.0.0 -docopt==0.6.2 -html5lib==0.999999999 -lxml==3.7.0 -Pillow==3.4.2 -pycparser==2.17 -Pyphen==0.9.4 -requests==2.12.3 -six==1.10.0 -tinycss==0.4 +cffi>=1.9.1 +cssselect>=1.0.0 +docopt>=0.6.2 +html5lib>=0.999999999 +lxml>=3.7.0 +Pillow>=3.4.2 +pycparser>=2.17 +Pyphen>=0.9.4 +requests>=2.12.3 +tinycss>=0.4 WeasyPrint>=0.33 -webencodings==0.5 +webencodings>=0.5 -- cgit v1.2.3 From a3e6d416cf1a2f670548b4602e3090722b0769c8 Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 18:10:17 +0300 Subject: new fix for .travis.yml --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 110f781..69e0531 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: python +branches: + only: + master python: - "3.3" - "3.4" @@ -7,5 +10,6 @@ python: # command to install dependencies install: "pip install -r requirements.txt" # command to run tests -script: python -m unittest habr/user.py -script: python -m unittest habr/topic.py +script: + - python -m unittest habr/user.py + - python -m unittest habr/topic.py -- cgit v1.2.3 From b450d5a466e1cc35d77d3b52e95b466450f9f7ca Mon Sep 17 00:00:00 2001 From: icoz Date: Sun, 12 Feb 2017 18:18:47 +0300 Subject: =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D1=8B=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20python=203.5=20=D0=B8=203.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 -- README.md | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 69e0531..9e584c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ branches: only: master python: - - "3.3" - - "3.4" - "3.5" - "3.6" # command to install dependencies diff --git a/README.md b/README.md index 18ee00c..72474e3 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Changelog: - Добавлены мета теги для лучшего поиска PDF - Исправлена вставка автора(вставляется ссылка на автора рабочая) - Решана проблема с маштабированием изображений +- Теперь тестируется только python 3.5 и 3.6, на других версиях тоже может работать. *01.02.2015* - исправлены ошибки -- cgit v1.2.3