implemented client side filters, mobile first styling and modals for articles

This commit is contained in:
2025-08-02 01:33:49 +02:00
parent e1f51794af
commit ccc1a90cbe
14 changed files with 1248 additions and 131 deletions

View File

@@ -175,31 +175,53 @@ class DatabaseManager:
A database cursor for executing SQL statements
"""
conn = None
cursor = None
try:
conn = self._get_connection()
cursor = conn.cursor()
if readonly:
conn.execute("BEGIN DEFERRED")
else:
conn.execute("BEGIN IMMEDIATE")
cursor = conn.cursor()
yield cursor
if not readonly:
conn.commit()
else:
# For readonly transactions, we still need to end the transaction
conn.commit()
except sqlite3.OperationalError as e:
if conn:
conn.rollback()
try:
conn.rollback()
except:
pass
if "database is locked" in str(e).lower():
logger.warning(
f"⚠️ Database temporarily locked, operation may need retry: {e}")
raise e
except Exception as e:
if conn:
conn.rollback()
try:
conn.rollback()
except:
pass
raise e
finally:
if cursor:
try:
cursor.close()
except:
pass
if conn:
conn.close()
try:
conn.close()
except:
pass
@contextmanager
def get_cursor_with_retry(self,