From 31b8f66abe7ac3ac81df41ad376a3ee5b9939075 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Tue, 5 Sep 2017 07:45:57 +0000 Subject: [PATCH] Typo, this can be none at times --- webapp/titanembeds/database/keyvalue_properties.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/titanembeds/database/keyvalue_properties.py b/webapp/titanembeds/database/keyvalue_properties.py index cc2be9f..64db514 100644 --- a/webapp/titanembeds/database/keyvalue_properties.py +++ b/webapp/titanembeds/database/keyvalue_properties.py @@ -20,14 +20,14 @@ def set_keyvalproperty(key, value, expiration=None): def get_keyvalproperty(key): q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key) now = datetime.now() - if q.count() > 0 and (q.first().expiration.replace(tzinfo=None) is None or q.first().expiration.replace(tzinfo=None) > now.replace(tzinfo=None)): + if q.count() > 0 and (q.first().expiration is None or q.first().expiration.replace(tzinfo=None) > now.replace(tzinfo=None)): return q.first().value return None def getexpir_keyvalproperty(key): q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key) now = datetime.now() - if q.count() > 0 and (q.first().expiration.replace(tzinfo=None) is not None and q.first().expiration.replace(tzinfo=None) > now.replace(tzinfo=None)): + if q.count() > 0 and (q.first().expiration is not None and q.first().expiration.replace(tzinfo=None) > now.replace(tzinfo=None)): return int(q.first().expiration.strftime('%s')) return 0