bugfix: installation permissions error for sqlite writing
This commit is contained in:
@@ -28,6 +28,10 @@ or by executing kjv-api-test.sh which will listen on 0.0.0.0:1612
|
||||
|
||||
Visiting the base directory will show the user-facing documentation via web browser or cURL.
|
||||
|
||||
When testing or doing a deployment, the data directory must be owned by whatever user is
|
||||
running the program in order to prevent a sqlite3.OperationalError for writing to a "readonly"
|
||||
database.
|
||||
|
||||
CONTENTS
|
||||
========
|
||||
.
|
||||
|
||||
@@ -520,11 +520,14 @@ def sequential_read(start=0, num=1, uid=None, getuid=False):
|
||||
|
||||
start = verse_ids.index(int(show(kw=start, get_start_verse_id=True)))
|
||||
uid = str(uuid.uuid4())
|
||||
seq_cur.execute(
|
||||
"INSERT INTO reading_tracker VALUES('{}', {}, '{}')".format(
|
||||
uid, start, last_used
|
||||
try:
|
||||
seq_cur.execute(
|
||||
"INSERT INTO reading_tracker VALUES('{}', {}, '{}')".format(
|
||||
uid, start, last_used
|
||||
)
|
||||
)
|
||||
)
|
||||
except sqlite3.OperationalError:
|
||||
return jsonify({"error":"Something went wrong with the database. Check permissions?"})
|
||||
seq_conn.commit()
|
||||
dbg2("Created new UID: {}".format(uid))
|
||||
return "Your new UID is: {}".format(uid)
|
||||
|
||||
Reference in New Issue
Block a user