Skip to content

Commit 2bcb981

Browse files
Fix 500 error for new users
1 parent 3f204f2 commit 2bcb981

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/cwa_db.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ def set_default_settings(self, force=False) -> None:
233233
def get_cwa_settings(self) -> dict:
234234
"""Gets the current cwa_settings values from the table of the same name in cwa.db and returns them as a dict"""
235235
self.cur.execute("SELECT * FROM cwa_settings")
236+
if self.cur.fetchall() == []: # If settings table is empty, populates it with default values
237+
self.cur.execute("INSERT INTO cwa_settings DEFAULT VALUES;")
238+
self.con.commit()
236239
headers = [header[0] for header in self.cur.description]
237240
cwa_settings = [dict(zip(headers,row)) for row in self.cur.fetchall()][0]
238241

0 commit comments

Comments
 (0)