From 25f702c3fffa53489bcd3e79d0e9abe9c49d9f91 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Wed, 5 May 2021 23:32:20 +0800 Subject: [PATCH] fix bug caused by null --- RSSEntry.py | 2 +- database.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/RSSEntry.py b/RSSEntry.py index ce0e2d8..c2e41a2 100644 --- a/RSSEntry.py +++ b/RSSEntry.py @@ -126,7 +126,7 @@ class RSSEntry: self.url = data[1] self.interval = None if data is not None and data[2] is not None: - self.interval = int(data[2]) + self.interval = data[2] self.lastupdatetime = None if data is not None and data[3] is not None: self.lastupdatetime = data[3] diff --git a/database.py b/database.py index 20e50c8..333caef 100644 --- a/database.py +++ b/database.py @@ -165,12 +165,11 @@ PRIMARY KEY (hash) if has_data: self._db.execute( f"UPDATE RSSList SET title=?, interval=? WHERE id=?;", - (title, ttl if ttl is not None else 'null', hashd)) + (title, ttl, hashd)) else: self._db.execute( f"INSERT INTO RSSList VALUES (?, ?, ?, ?, ?, null, false, 0);", - (title, url, ttl if ttl is not None else 'null', - int(time()), hashd)) + (title, url, ttl, int(time()), hashd)) cur = self._db.execute( f'SELECT * FROM chatList WHERE id=? AND chatId=?;', (hashd, chatId)) @@ -343,7 +342,7 @@ PRIMARY KEY (hash) return False self._db.execute( f"UPDATE RSSList SET title=?, interval=?, lastupdatetime=?, errorcount=0 WHERE id=?;", - (title, ttl if ttl is not None else 'null', lastupdatetime, hashd)) + (title, ttl, lastupdatetime, hashd)) cur = self._db.execute( f"SELECT * FROM hashList WHERE id=?;", (hashd,)) has_data2 = False