From 5fa7f1a63ce4af2c088ff2323a4db67ef22c516e Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Tue, 10 Sep 2019 18:49:33 +0200 Subject: [PATCH 1/2] Change link to utf-8 before request done. Link objects have link_targets saved as unicode strings. Before calling them with requests we need to encode them. --- docs/HISTORY.txt | 2 +- ftw/linkchecker/linkchecker.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index a153c32..d7185d8 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -5,7 +5,7 @@ Changelog 1.3.1 (unreleased) ------------------ -- Nothing changed yet. +- Log and make requests with link utf-8 encoded. [busykoala] 1.3.0 (2019-09-10) diff --git a/ftw/linkchecker/linkchecker.py b/ftw/linkchecker/linkchecker.py index e0a3a51..6d4aa9b 100644 --- a/ftw/linkchecker/linkchecker.py +++ b/ftw/linkchecker/linkchecker.py @@ -13,7 +13,8 @@ def millis(): def get_uri_response(external_link_obj, timeout): logger = logging.getLogger(LOGGER_NAME) - logger.info('Head request to {}'.format(external_link_obj.link_target)) + logger.info('Head request to {}'.format( + external_link_obj.link_target.encode('utf-8'))) headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36' @@ -22,7 +23,7 @@ def get_uri_response(external_link_obj, timeout): response = None start_time = millis() try: - response = requests.head(external_link_obj.link_target, + response = requests.head(external_link_obj.link_target.encode('utf-8'), timeout=timeout, headers=headers, allow_redirects=False, From 5069ad40ec49fc97c4b3b2992a37fccda1a3ea4c Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Tue, 10 Sep 2019 19:30:43 +0200 Subject: [PATCH 2/2] Add table attribute so extend autofilter. --- docs/HISTORY.txt | 1 + ftw/linkchecker/command/broken_link.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt index d7185d8..da0eb7a 100644 --- a/docs/HISTORY.txt +++ b/docs/HISTORY.txt @@ -6,6 +6,7 @@ Changelog ------------------ - Log and make requests with link utf-8 encoded. [busykoala] +- Extend LinkObject table attributes so autofilter covers all columns. [busykoala] 1.3.0 (2019-09-10) diff --git a/ftw/linkchecker/command/broken_link.py b/ftw/linkchecker/command/broken_link.py index 1e5d76e..8b43ea9 100644 --- a/ftw/linkchecker/command/broken_link.py +++ b/ftw/linkchecker/command/broken_link.py @@ -15,7 +15,8 @@ class BrokenLink(object): 'content_type', 'response_time', 'error_message', - 'creator' + 'creator', + 'source_state' ] def __init__(self):