From 233c71385fab31dd75881507375670e25176f216 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 15 Feb 2024 18:17:18 +0300 Subject: [PATCH] more-instance-check --- resolvers/editor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resolvers/editor.py b/resolvers/editor.py index 29d01a4a..5eeb340a 100644 --- a/resolvers/editor.py +++ b/resolvers/editor.py @@ -45,7 +45,7 @@ async def create_shout(_, info, inp): user_id = info.context['user_id'] with local_session() as session: author = session.query(Author).filter(Author.user == user_id).first() - if author: + if isinstance(author, Author): current_time = int(time.time()) slug = inp.get('slug') or f'draft-{current_time}' shout_dict = { @@ -168,7 +168,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False): with local_session() as session: author = session.query(Author).filter(Author.user == user_id).first() current_time = int(time.time()) - if author: + if isinstance(author, Author): shout = ( session.query(Shout) .options(