|
|
@ -71,7 +71,8 @@ def impose_cards(fpath): |
|
|
|
def home(): |
|
|
|
upload_form = UploadForm() |
|
|
|
pname = petname.generate() |
|
|
|
pname_msg = "You are now {}".format(pname) |
|
|
|
pname_msg = "Index of/~{}".format(pname) |
|
|
|
# pname_msg = "You are now {}".format(pname) |
|
|
|
return render_template( |
|
|
|
"index.html", |
|
|
|
upload_form=upload_form, |
|
|
@ -79,6 +80,11 @@ def home(): |
|
|
|
petname_message=pname_msg, |
|
|
|
) |
|
|
|
|
|
|
|
@app.route("/about") |
|
|
|
def about(): |
|
|
|
return render_template( |
|
|
|
"about.html", |
|
|
|
) |
|
|
|
|
|
|
|
@app.route("/upload", methods=["POST"]) |
|
|
|
def upload(): |
|
|
@ -89,8 +95,10 @@ def upload(): |
|
|
|
pname = upload_form.petname.data |
|
|
|
metadata_name = "metadata-{}.db".format(pname) |
|
|
|
if not Path(os.path.join(CWD, "metadatum", metadata_name)).exists(): |
|
|
|
flash("Woops, you forgot to upload a metadata file?") |
|
|
|
pname_msg = "You are still {}".format(pname) |
|
|
|
flash("Oops, you forgot to upload a metadata file...") |
|
|
|
# pname_msg = "You are still {}".format(pname) |
|
|
|
pname_msg = "Index of/~{}".format(pname) |
|
|
|
|
|
|
|
return render_template( |
|
|
|
"index.html", |
|
|
|
upload_form=upload_form, |
|
|
@ -99,7 +107,9 @@ def upload(): |
|
|
|
) |
|
|
|
|
|
|
|
pname = upload_form.petname.data |
|
|
|
pname_msg = "You are still {}".format(pname) |
|
|
|
# pname_msg = "You are still {}".format(pname) |
|
|
|
pname_msg = "Index of/~{}".format(pname) |
|
|
|
|
|
|
|
|
|
|
|
metadata_name = "metadata-{}.db".format(pname) |
|
|
|
if upload_form.metadata.data: |
|
|
@ -107,6 +117,7 @@ def upload(): |
|
|
|
f.save(os.path.join(CWD, "metadatum", metadata_name)) |
|
|
|
|
|
|
|
pdf_name = "index-{}.pdf".format(pname) |
|
|
|
# pdf_view = "{}.pdf#view=FitH".join(pname) |
|
|
|
pdf_path = os.path.join(CWD, "static", "generated", pdf_name) |
|
|
|
metadata_conn = "sqlite:///{}".format( |
|
|
|
os.path.join(CWD, "metadatum", metadata_name) |
|
|
|