1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-03-09 11:51:09 +00:00

py-i2phosts-maint: add workaround for situation when we updating expires first time

This commit is contained in:
Hidden Z 2010-10-27 16:16:00 +00:00
parent e0e6113808
commit 9a6cc81403

@ -57,7 +57,11 @@ for host in all_hosts:
else:
timedelta = datetime.timedelta(days=60)
# get current host expiration date from database
expires_current = host.expires
if host.expires == None:
# workaround for situation when we updating expires first time
expires_current = datetime.datetime.now().date()
else:
expires_current = host.expires
# calculate new expiration date
expires_new = host.last_seen + timedelta
expires_new = expires_new.date()