30->5 min wait on cleanup. Strip errors.
Small formatting tweaks in writing.html
This commit is contained in:
parent
e10f876214
commit
b591532ae8
|
@ -28,6 +28,7 @@
|
||||||
if (document.getElementById('company').value === "BananaCorp") {
|
if (document.getElementById('company').value === "BananaCorp") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
cookies = [
|
cookies = [
|
||||||
'username',
|
'username',
|
||||||
'company',
|
'company',
|
||||||
|
@ -62,6 +63,7 @@
|
||||||
{{ render_field(form.body, 'class=bigtext') }}
|
{{ render_field(form.body, 'class=bigtext') }}
|
||||||
{{ render_field(form.closingtext) }}
|
{{ render_field(form.closingtext) }}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{% if errors %}
|
{% if errors %}
|
||||||
<div id=errors>
|
<div id=errors>
|
||||||
<h3>Your letter has errors.</h3>
|
<h3>Your letter has errors.</h3>
|
||||||
|
@ -77,9 +79,10 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p><input type=submit value="Submit"
|
<p><input type=submit value="Submit"
|
||||||
{% if errors %}
|
{% if errors %}
|
||||||
onclick="var elem = document.getElementById('errors'); elem.parentNode.removeChild(elem);"
|
onclick="var e = document.getElementById('errors'); e.parentNode.removeChild(e);"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
></p>
|
></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
4
latty.py
4
latty.py
|
@ -62,7 +62,7 @@ class CLData():
|
||||||
|
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
print(build_text + "[SUCCESS]")
|
print(build_text + "[SUCCESS]")
|
||||||
threading.Timer(60 * 30, cleanup, [output_dir + unique_id]).start()
|
threading.Timer(60 * 5, cleanup, [output_dir + unique_id]).start()
|
||||||
|
|
||||||
return (send_from_directory(
|
return (send_from_directory(
|
||||||
output_dir,
|
output_dir,
|
||||||
|
@ -73,7 +73,7 @@ class CLData():
|
||||||
else:
|
else:
|
||||||
print(build_text + "[FAIL]")
|
print(build_text + "[FAIL]")
|
||||||
# Collect output but delete boilerplate text
|
# Collect output but delete boilerplate text
|
||||||
errors = result.stdout.split("\n")
|
errors = list(map(str.strip, result.stdout.split("\n")))
|
||||||
del errors[:13]
|
del errors[:13]
|
||||||
del errors[-2:]
|
del errors[-2:]
|
||||||
return (None, errors)
|
return (None, errors)
|
||||||
|
|
|
@ -62,12 +62,12 @@ def index():
|
||||||
)
|
)
|
||||||
|
|
||||||
(resp, errors) = data.generate_pdf()
|
(resp, errors) = data.generate_pdf()
|
||||||
# Save entered data as cookies on user's machine
|
|
||||||
if errors:
|
if errors:
|
||||||
resp = make_response(render_template('writing.html',
|
resp = make_response(render_template('writing.html',
|
||||||
form=form,
|
form=form,
|
||||||
errors=errors,
|
errors=errors,
|
||||||
))
|
))
|
||||||
|
# Save entered data as cookies on user's machine
|
||||||
for pair in data.get_pairs():
|
for pair in data.get_pairs():
|
||||||
resp.set_cookie(pair[0], urllib.parse.quote(pair[1]))
|
resp.set_cookie(pair[0], urllib.parse.quote(pair[1]))
|
||||||
return resp
|
return resp
|
||||||
|
|
Loading…
Reference in New Issue