From 7dd89df9d07f9a805f82081b10d4d4586873fe61 Mon Sep 17 00:00:00 2001 From: anastasia Date: Thu, 17 Aug 2017 17:53:02 -0400 Subject: [PATCH] refactor - minor fixes in phrasing and boolean returns --- perma_web/perma/utils.py | 6 ++---- perma_web/perma/views/common.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/perma_web/perma/utils.py b/perma_web/perma/utils.py index 76701ae23..3b4c1f7ab 100644 --- a/perma_web/perma/utils.py +++ b/perma_web/perma/utils.py @@ -257,13 +257,11 @@ def parse_user_agent(user_agent_str): return user_agent_parser.ParseUserAgent(user_agent_str) -### pdf handling on mobile apple ### +### pdf handling on mobile ### def redirect_to_download(capture_mime_type, user_agent_str): # redirecting to a page with a download button (and not attempting to display) # if mobile apple device, and the request is a pdf parsed_agent = parse_user_agent(user_agent_str) - if "Mobile" in parsed_agent["family"] and "pdf" in capture_mime_type: - return True - return False + return "Mobile" in parsed_agent["family"] and "pdf" in capture_mime_type diff --git a/perma_web/perma/views/common.py b/perma_web/perma/views/common.py index 0ba91940a..adbff60f1 100755 --- a/perma_web/perma/views/common.py +++ b/perma_web/perma/views/common.py @@ -214,7 +214,7 @@ def make_warcinfo(filename, guid, coll_title, coll_desc, rec_title, pages): # Redirecting to a download page if on mobile try: capture_mime_type = capture.mime_type() - redirect_to_download_view = redirect_to_download(capture.mime_type(), raw_user_agent) + redirect_to_download_view = redirect_to_download(capture_mime_type, raw_user_agent) except AttributeError: # if capture is deleted, we will catch it here capture_mime_type = None