aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Yu <andrew@andrewyu.org>2023-01-29 13:55:17 +0100
committerAndrew Yu <andrew@andrewyu.org>2023-01-29 13:55:17 +0100
commitaf86f84d1634573d662953619fcd9d4495a74c0f (patch)
tree8a32b2c0147ff4f259f10e1cf28408b2c8944b1d
parentfe9e7573900a191c48135b5eec18dc3408e77fcc (diff)
downloadqbox-af86f84d1634573d662953619fcd9d4495a74c0f.tar.gz
qbox-af86f84d1634573d662953619fcd9d4495a74c0f.zip
Pretty-print database output
-rw-r--r--app.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/app.py b/app.py
index be1a505..1e1f226 100644
--- a/app.py
+++ b/app.py
@@ -41,7 +41,7 @@ app = Flask(__name__)
def append_question(text, ts):
db.append({"q": text, "a": None, "ts": ts})
with open("db.json", "w") as db_file:
- json.dump(db, db_file)
+ json.dump(db, db_file, indent=4)
def gpq():
gd = ""
@@ -71,6 +71,7 @@ def index():
if "text" in request.form and request.form["text"].strip():
text = request.form["text"]
append_question(text, ts)
+ print(text + "\a")
else:
return Response("Empty submissions are forbidden.", mimetype='text/plain')
return Response("Submission successful.", mimetype='text/plain')