def read_pdf(filename):
    if not os.path.exists(filename):
        raise CommandError("{} does not exist".format(filename))
    pdf = PdfFileReader(file(filename, "rb"))
    if pdf.isEncrypted:
        while True:
            pw = prompt_for_pw(filename)
            matched = pdf.decrypt(pw)
            if matched:
                break
            else:
                print "The password did not match."
    return pdf
Returns context data used for rendering the view.
dataset/ETHPy150Open hellerbarde/stapler/staplelib/iohelper.py/read_pdf--crossover with--dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/diffviewer/views.py/DiffFragmentView.get_context_data