From a4facf0c2a367f1b4b94620eb4cfce18897eca65 Mon Sep 17 00:00:00 2001 From: Worros Date: Wed, 10 Nov 2010 12:46:48 +0800 Subject: [PATCH] Filters: Fix date defaults when no hands inserted --- pyfpdb/Filters.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 1b07a67c..1b026d29 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -1060,14 +1060,20 @@ class Filters(threading.Thread): if t1 == '': self.cursor.execute(self.sql.query['get_first_date']) result = self.db.cursor.fetchall() - t1 = result[0][0].split()[0] - self.start_date.set_text(t1) + if result[0][0] == None: + t1 = '1970-01-02' + else: + t1 = result[0][0].split()[0] + self.start_date.set_text(t1) if t2 == '': self.cursor.execute(self.sql.query['get_last_date']) result = self.db.cursor.fetchall() - t2 = result[0][0].split()[0] - self.end_date.set_text(t2) + if result[0][0] == None: + t2 = '2020-12-12' + else: + t2 = result[0][0].split()[0] + self.end_date.set_text(t2) s1 = strptime(t1, "%Y-%m-%d") # make time_struct s2 = strptime(t2, "%Y-%m-%d")