From 765da560373661ce01e1620e26493e525ac7facc Mon Sep 17 00:00:00 2001 From: Tavi Date: Wed, 30 Nov 2022 21:49:29 +0000 Subject: [PATCH] Fix some issues that cause incompatibility with postgres --- app.py | 2 +- moa/tweet_poster.py | 2 +- moa/worker.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index b1bcb8d..418ac75 100644 --- a/app.py +++ b/app.py @@ -476,7 +476,7 @@ def mastodon_oauthorized(): username = creds["username"] account_id = creds["id"] - bridge = db.session.query(Bridge).filter_by(mastodon_account_id=account_id, mastodon_host_id=masto_host.id).first() + bridge = db.session.query(Bridge).filter_by(mastodon_account_id=str(account_id), mastodon_host_id=masto_host.id).first() if bridge: session['bridge_id'] = bridge.id diff --git a/moa/tweet_poster.py b/moa/tweet_poster.py index b910bb0..0f1f78a 100644 --- a/moa/tweet_poster.py +++ b/moa/tweet_poster.py @@ -60,7 +60,7 @@ class TweetPoster(Poster): # In the case where a toot has been broken into multiple tweets # we want the last one posted - mapping = self.session.query(Mapping).filter_by(mastodon_id=post.in_reply_to_id).order_by( + mapping = self.session.query(Mapping).filter_by(mastodon_id=str(post.in_reply_to_id)).order_by( Mapping.created.desc()).first() if mapping: diff --git a/moa/worker.py b/moa/worker.py index 733cb48..dfd25d3 100644 --- a/moa/worker.py +++ b/moa/worker.py @@ -136,7 +136,7 @@ bridges = session.query(Bridge).filter_by(enabled=True).filter(BridgeMetadata.wo l.info(f"Working on {bridges.count()} bridges") if 'sqlite' not in c.SQLALCHEMY_DATABASE_URI and not c.DEVELOPMENT: - bridges = bridges.order_by(func.rand()) + bridges = bridges.order_by(func.random()) bridge_count = 0 -- GitLab