Fix: KeyError
This commit is contained in:
parent
a03a5558d6
commit
d70b7db79a
|
@ -53,7 +53,7 @@ class PasteView(View):
|
||||||
paste = get_object_or_404(Paste, slug=path)
|
paste = get_object_or_404(Paste, slug=path)
|
||||||
paste.incr_viewcount()
|
paste.incr_viewcount()
|
||||||
|
|
||||||
if "html" in request.headers["accept"]:
|
if "html" in request.headers.get("accept", "html"):
|
||||||
return HttpResponse(paste_to_html(paste.filename, paste.content))
|
return HttpResponse(paste_to_html(paste.filename, paste.content))
|
||||||
else:
|
else:
|
||||||
return HttpResponse(paste.content, content_type="text/plain")
|
return HttpResponse(paste.content, content_type="text/plain")
|
||||||
|
@ -124,7 +124,7 @@ class ListView(View):
|
||||||
"viewcount",
|
"viewcount",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if "html" in request.headers["accept"]:
|
if "html" in request.headers.get("accept", "html"):
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
loader.render_to_string(
|
loader.render_to_string(
|
||||||
"paste/show-markdown.html", {"highlighted": markdown_to_html(table)}
|
"paste/show-markdown.html", {"highlighted": markdown_to_html(table)}
|
||||||
|
|
Loading…
Reference in New Issue