forked from rDrama/rDrama
fix 500 error
parent
7747b7844a
commit
e990757bda
|
@ -72,16 +72,17 @@ def after_request(response):
|
||||||
if FEATURES['IP_LOGGING']:
|
if FEATURES['IP_LOGGING']:
|
||||||
if g.v.admin_level < PERMS['EXEMPT_FROM_IP_LOGGING'] and user_id != CARP_ID:
|
if g.v.admin_level < PERMS['EXEMPT_FROM_IP_LOGGING'] and user_id != CARP_ID:
|
||||||
ip = get_IP()
|
ip = get_IP()
|
||||||
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
|
if ip:
|
||||||
if existing:
|
existing = g.db.query(IPLog).filter_by(user_id=user_id, ip=ip).one_or_none()
|
||||||
existing.last_used = time.time()
|
if existing:
|
||||||
g.db.add(existing)
|
existing.last_used = time.time()
|
||||||
else:
|
g.db.add(existing)
|
||||||
ip_log = IPLog(
|
else:
|
||||||
user_id=user_id,
|
ip_log = IPLog(
|
||||||
ip=ip,
|
user_id=user_id,
|
||||||
)
|
ip=ip,
|
||||||
g.db.add(ip_log)
|
)
|
||||||
|
g.db.add(ip_log)
|
||||||
|
|
||||||
_commit_and_close_db()
|
_commit_and_close_db()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue