From 57cadb2e11c4cb823e0881aa3e20ca72959d2853 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Tue, 8 Nov 2022 23:12:17 +0800 Subject: [PATCH] fix/nonetype error? --- BDSM/toot.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BDSM/toot.py b/BDSM/toot.py index e1a7f19..f4ec3ca 100644 --- a/BDSM/toot.py +++ b/BDSM/toot.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -from types import NoneType from mastodon import Mastodon from BDSM import db from BDSM.models import Other, Toot, Tag, Media, Emoji, Poll @@ -141,7 +140,7 @@ def toot_process(statuses, my_acct, duplicates_counter=0): if not is_reblog: data=Emoji.query.filter_by(shortcode=shortcode, acct=acct).first() - if data is None or NoneType: + if data == None: emoji_data = Emoji(shortcode=shortcode, acct=acct, url=emoji['url'], @@ -151,7 +150,10 @@ def toot_process(statuses, my_acct, duplicates_counter=0): # cur.execute('''INSERT INTO EMOJI (shortcode,url,static_url,count) \ # VALUES (?,?,?,?)''', (shortcode, emoji['url'], emoji['static_url'], count)) else: - data.count += count + if data.count == None: + data.count = count + else: + data.count += count # cur.execute("UPDATE EMOJI SET count = ? WHERE shortcode = ?",(count, shortcode)) else: emoji_data = Emoji(shortcode=shortcode,