fix 500 error

pull/222/head
Aevann 2024-02-06 03:20:46 +02:00
parent 7747b7844a
commit e990757bda
1 changed files with 11 additions and 10 deletions

View File

@ -72,16 +72,17 @@ def after_request(response):
if FEATURES['IP_LOGGING']:
if g.v.admin_level < PERMS['EXEMPT_FROM_IP_LOGGING'] and user_id != CARP_ID:
ip = get_IP()
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
if existing:
existing.last_used = time.time()
g.db.add(existing)
else:
ip_log = IPLog(
user_id=user_id,
ip=ip,
)
g.db.add(ip_log)
if ip:
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
if existing:
existing.last_used = time.time()
g.db.add(existing)
else:
ip_log = IPLog(
user_id=user_id,
ip=ip,
)
g.db.add(ip_log)
_commit_and_close_db()