From 87c0487d505e6d57d0a4ea9c147f96a6eff79700 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Thu, 9 Feb 2017 21:25:37 -0800 Subject: [PATCH] Remove debug print statements and fix db timestamp --- titanembeds/blueprints/api/api.py | 2 -- titanembeds/database/unauthenticated_users.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/titanembeds/blueprints/api/api.py b/titanembeds/blueprints/api/api.py index 3ab4784..56a98a7 100644 --- a/titanembeds/blueprints/api/api.py +++ b/titanembeds/blueprints/api/api.py @@ -27,7 +27,6 @@ def checkUserBanned(guild_id, ip_address=None): banned = True if user_unauthenticated(): dbUser = UnauthenticatedBans.query.filter(and_(UnauthenticatedBans.guild_id == guild_id, UnauthenticatedBans.ip_address == ip_address)).all() - print dbUser if not dbUser: banned = False else: @@ -93,7 +92,6 @@ def fetch(): else: key = None status = update_user_status(channel_id, session['username'], key) - print status['revoked'] if status['banned'] or status['revoked']: messages = {} else: diff --git a/titanembeds/database/unauthenticated_users.py b/titanembeds/database/unauthenticated_users.py index e22d250..bb2f769 100644 --- a/titanembeds/database/unauthenticated_users.py +++ b/titanembeds/database/unauthenticated_users.py @@ -1,5 +1,6 @@ from titanembeds.database import db import datetime +import time import random import string @@ -20,7 +21,7 @@ class UnauthenticatedUsers(db.Model): self.discriminator = discriminator self.user_key = "".join(random.choice(string.ascii_letters) for _ in range(0, 32)) self.ip_address = ip_address - self.last_timestamp = datetime.datetime.now + self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') self.revoked = False def __repr__(self): @@ -40,6 +41,6 @@ class UnauthenticatedUsers(db.Model): return self.revoked def bumpTimestamp(self): - self.last_timestamp = datetime.datetime.now + self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') db.session.commit() return self.last_timestamp