diff --git a/flaskr/templates/writing.html b/flaskr/templates/writing.html index 862c817..9a5e70b 100644 --- a/flaskr/templates/writing.html +++ b/flaskr/templates/writing.html @@ -28,6 +28,7 @@ if (document.getElementById('company').value === "BananaCorp") { return } + cookies = [ 'username', 'company', @@ -62,8 +63,9 @@ {{ render_field(form.body, 'class=bigtext') }} {{ render_field(form.closingtext) }} + {% if errors %} -
+

Your letter has errors.

There is likely a typo in one of your variables (the {\blabla} bits). @@ -71,15 +73,16 @@ side

- {% for error in errors %} - {{ error }}
- {% endfor %} + {% for error in errors %} + {{ error }}
+ {% endfor %}

-
+
{% endif %} +

diff --git a/latty.py b/latty.py index 838528c..d63a4b5 100644 --- a/latty.py +++ b/latty.py @@ -62,7 +62,7 @@ class CLData(): if result.returncode == 0: 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( output_dir, @@ -73,7 +73,7 @@ class CLData(): else: print(build_text + "[FAIL]") # 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[-2:] return (None, errors) diff --git a/writing.py b/writing.py index c3e727d..3dc8862 100644 --- a/writing.py +++ b/writing.py @@ -62,12 +62,12 @@ def index(): ) (resp, errors) = data.generate_pdf() - # Save entered data as cookies on user's machine if errors: resp = make_response(render_template('writing.html', form=form, errors=errors, )) + # Save entered data as cookies on user's machine for pair in data.get_pairs(): resp.set_cookie(pair[0], urllib.parse.quote(pair[1])) return resp