Commit b4d420f8 authored by dario's avatar dario

web/views: clean error-handling for nonexistant PDFs

parent cf473888
......@@ -142,12 +142,11 @@ def str_truncate_if_tail_matches(s, tl):
@expose('/public_pdf/<pdffile>')
def send_pdf_file(request, pdffile):
pdfid = str_truncate_if_tail_matches(pdffile, ".pdf")
dbitem = public_pdf_db[pdfid]
if not dbitem:
if not pdfid in public_pdf_db:
return render_template('error.xml',
error_text='There is no PDF file with that ID',
theme=local.theme)
meta = dbitem.metadata
meta = public_pdf_db[pdfid].metadata
is_internal = remote_is_internal_network(request)
## this uses a => b == !a v b, so what it wants to say is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment