Validate AVConnect credentials on saving. Improved AVConnect login method. Fixed issue with UTC datetimes

This commit is contained in:
Ettore
2026-05-09 18:18:10 +02:00
parent 69e4f594de
commit 0cb35a30cb
8 changed files with 60 additions and 16 deletions

View File

@@ -1,7 +1,19 @@
import logging
import os
from datetime import datetime, timezone
from typing import Optional
def utcnow() -> datetime:
"""Return the current UTC time as a timezone-naive datetime.
SQLite (and SQLAlchemy's default column handling) stores datetimes without
timezone info. Using this helper keeps all DB timestamps and comparisons
consistent and avoids TypeError on offset-naive vs offset-aware comparisons.
"""
return datetime.now(timezone.utc).replace(tzinfo=None)
# ── Paths ─────────────────────────────────────────────────────────────────────
_HERE = os.path.dirname(os.path.abspath(__file__)) # src/core/
_SRC_DIR = os.path.dirname(_HERE) # src/