diff --git a/docassemble/AssemblyLine/al_document.py b/docassemble/AssemblyLine/al_document.py index 5705efd8..236e0f81 100644 --- a/docassemble/AssemblyLine/al_document.py +++ b/docassemble/AssemblyLine/al_document.py @@ -41,7 +41,6 @@ import secrets import string - __all__ = [ "ALAddendumField", "ALAddendumFieldDict", diff --git a/docassemble/AssemblyLine/sessions.py b/docassemble/AssemblyLine/sessions.py index 83c40fe1..f68e81b7 100644 --- a/docassemble/AssemblyLine/sessions.py +++ b/docassemble/AssemblyLine/sessions.py @@ -301,15 +301,13 @@ def get_interview_metadata( Returns: Dict[str, Any]: The metadata associated with the interview """ - sql = text( - """ + sql = text(""" SELECT data FROM jsonstorage WHERE filename = :filename AND tags = :tags AND key = :session_id - """ - ) + """) with db.connect() as con: row = con.execute( sql, @@ -590,8 +588,7 @@ def find_matching_sessions( else: filename_condition = "TRUE" # If no filenames are provided, this condition does not filter anything. - get_sessions_query = text( - f""" + get_sessions_query = text(f""" SELECT * FROM ( SELECT DISTINCT ON (userdict.key) userdict.indexno, userdict.filename as filename, @@ -618,8 +615,7 @@ def find_matching_sessions( ) AS unique_sessions ORDER BY modtime DESC LIMIT :limit OFFSET :offset; - """ - ) + """) if offset < 0: offset = 0 @@ -703,8 +699,7 @@ def delete_interview_sessions( "User that is not logged in does not have permission to delete any sessions" ) return None - delete_sessions_query = text( - """ + delete_sessions_query = text(""" DELETE FROM userdictkeys WHERE user_id = :user_id AND @@ -712,8 +707,7 @@ def delete_interview_sessions( AND filename != :current_filename ; - """ - ) + """) if not user_id: user_id = user_info().id if user_id != user_info().id and not user_has_privilege(["developer", "admin"]): @@ -1743,15 +1737,13 @@ def to_signed_32(x: int) -> int: ) # 4) Try UPDATE first, using CAST() instead of ::jsonb - update_sql = text( - """ + update_sql = text(""" UPDATE jsonstorage SET data = jsonstorage.data || CAST(:data AS jsonb) WHERE key = :session_id AND filename = :filename AND tags = :tags - """ - ) + """) result = con.execute( update_sql, { @@ -1764,12 +1756,10 @@ def to_signed_32(x: int) -> int: # 5) If nothing was updated, INSERT if (result.rowcount or 0) == 0: - insert_sql = text( - """ + insert_sql = text(""" INSERT INTO jsonstorage (key, filename, tags, data) VALUES (:session_id, :filename, :tags, CAST(:data AS jsonb)) - """ - ) + """) con.execute( insert_sql, {