forked from MarseyWorld/MarseyWorld
fix 500 error
parent
7747b7844a
commit
e990757bda
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue