From 9a6cc814039744a1986bf0b8dc5493f1a5e27a97 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Wed, 27 Oct 2010 16:16:00 +0000 Subject: [PATCH] py-i2phosts-maint: add workaround for situation when we updating expires first time --- py-i2phosts-maint | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/py-i2phosts-maint b/py-i2phosts-maint index c30425d..18b6df8 100755 --- a/py-i2phosts-maint +++ b/py-i2phosts-maint @@ -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()