mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Strip timezone information completely for comparing
This commit is contained in:
parent
aa9075f484
commit
f5f3423e36
@ -20,14 +20,14 @@ def set_keyvalproperty(key, value, expiration=None):
|
|||||||
def get_keyvalproperty(key):
|
def get_keyvalproperty(key):
|
||||||
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
if q.count() > 0 and (q.first().expiration is None or q.first().expiration.replace(tzinfo=None) > 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)):
|
||||||
return q.first().value
|
return q.first().value
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getexpir_keyvalproperty(key):
|
def getexpir_keyvalproperty(key):
|
||||||
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
if q.count() > 0 and (q.first().expiration is not None and q.first().expiration.replace(tzinfo=None) > 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)):
|
||||||
return int(q.first().expiration.strftime('%s'))
|
return int(q.first().expiration.strftime('%s'))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user