Skip to content

Commit

Permalink
refactor - minor fixes in phrasing and boolean returns
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasia committed Aug 17, 2017
1 parent 55ec3fd commit 7dd89df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions perma_web/perma/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion perma_web/perma/views/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7dd89df

Please sign in to comment.