Skip to content

Commit

Permalink
Merge pull request #1276 from jcushman/tweaks2
Browse files Browse the repository at this point in the history
Tweaks
  • Loading branch information
Matthew Phillips committed Dec 10, 2015
2 parents 2eb6635 + 56a8c1a commit 8380774
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions perma_web/perma/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def proxy_capture(self, link_guid, user_agent=''):
link = Link.objects.get(guid=link_guid)
target_url = link.submitted_url

# allow pending tasks to be canceled outside celery by updating capture status
if link.primary_capture.status != "pending":
return

# Override user_agent for now, since PhantomJS doesn't like some user agents.
# This user agent is the Chrome on Linux that's most like PhantomJS 1.9.8.
Expand Down
8 changes: 6 additions & 2 deletions perma_web/static/js/pretty-print-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ function FormatJSON(oData, sIndent) {

$( document ).ready(function() {
$(".prettyprint").each(function() {
str = jQuery.parseJSON($(this).text());
$(this).html(FormatJSON(str));
try{
str = jQuery.parseJSON($(this).text());
$(this).html(FormatJSON(str));
}catch(e){
// invalid JSON
}
});
});

0 comments on commit 8380774

Please sign in to comment.