Remove cross-domain template dependencies from shared infrastructure
- macros/search.html: shared search input macros (mobile + desktop) - macros/cart_icon.html: shared cart icon/badge macro (count param, no DB) - macros/layout.html: inline hamburger icon, use shared search macro - _oob.html: use cart_mini_html fragment slot instead of cart template import - db/session.py: guard teardown rollback against committed/dead sessions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,11 +64,17 @@ def register_db(app: Quart):
|
||||
# If an exception occurred OR we didn't commit (still in txn), roll back.
|
||||
if hasattr(g, "s"):
|
||||
if exc is not None or g.s.in_transaction():
|
||||
if hasattr(g, "tx"):
|
||||
await g.tx.rollback()
|
||||
if hasattr(g, "tx") and g.tx.is_active:
|
||||
try:
|
||||
await g.tx.rollback()
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
if hasattr(g, "s"):
|
||||
await g.s.close()
|
||||
try:
|
||||
await g.s.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@app.errorhandler(Exception)
|
||||
async def mark_error(e):
|
||||
|
||||
Reference in New Issue
Block a user