[fix] settingsfor form

This commit is contained in:
Adrien Beudin 2017-10-04 00:52:03 +02:00
parent 6515f2604e
commit 0c20aea972

View File

@ -33,12 +33,12 @@ def okgreen(logging, ok_message):
sys.stderr.write("%s%s: %s%s" % (bcolors.OKGREEN, logging, bcolors.ENDC, ok_message)) sys.stderr.write("%s%s: %s%s" % (bcolors.OKGREEN, logging, bcolors.ENDC, ok_message))
sys.stderr.write("\n") sys.stderr.write("\n")
def makeform(template, settings, *gallery_settings): def makeform(template, settings, gallery_settings):
from_template = template.get_template("form.html") from_template = template.get_template("form.html")
form = base64.b64encode(from_template.render(settings=settings, gallery=gallery_settings).encode("Utf-8")) form = base64.b64encode(from_template.render(settings=settings, gallery=gallery_settings).encode("Utf-8"))
return str(form, 'utf-8') return str(form, 'utf-8')
def encrypt(password, template, gallery_path, settings, *gallery_settings): def encrypt(password, template, gallery_path, settings, gallery_settings):
encrypted_template = template.get_template("encrypted.html") encrypted_template = template.get_template("encrypted.html")
index_plain = Path("build").joinpath(gallery_path, "index.html") index_plain = Path("build").joinpath(gallery_path, "index.html")
encrypted = check_output('cat %s | openssl enc -e -base64 -A -aes-256-cbc -pass pass:"%s"' % (index_plain, password), shell=True) encrypted = check_output('cat %s | openssl enc -e -base64 -A -aes-256-cbc -pass pass:"%s"' % (index_plain, password), shell=True)