From efc6e1c326a7848bc6c47974433a3f67c9ff0db6 Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 1 Mar 2021 07:09:53 +0100 Subject: [PATCH] Remove dbsettings from init methods (would prevent initial migrations) --- msgio/gateways/matrix.py | 8 ++++---- msgio/gateways/telegram.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/msgio/gateways/matrix.py b/msgio/gateways/matrix.py index 6529138..ac83d80 100644 --- a/msgio/gateways/matrix.py +++ b/msgio/gateways/matrix.py @@ -13,10 +13,10 @@ from ..models import GatewayUser from ..helpers import run_filters class MatrixDispatcher: - def __init__(self, username=dbsettings.MATRIX_USERNAME, password=dbsettings.MATRIX_PASSWORD, homeserver=dbsettings.MATRIX_HOMESERVER): - self.username = username - self.password = password - self.homeserver = homeserver + def __init__(self, username=None, password=None, homeserver=None): + self.username = username or dbsettings.MATRIX_USERNAME + self.password = password or dbsettings.MATRIX_PASSWORD + self.homeserver = homeserver or dbsettings.MATRIX_HOMESERVER async def send(self, message, room_id): client = AsyncClient(self.homeserver, self.username) diff --git a/msgio/gateways/telegram.py b/msgio/gateways/telegram.py index 02afe6d..9feaefd 100644 --- a/msgio/gateways/telegram.py +++ b/msgio/gateways/telegram.py @@ -16,7 +16,8 @@ class TelegramWebhookView(View): pass # TODO: Implement webhook receiver and management tool class TelegramDispatcher: - def __init__(self, token=dbsettings.TELEGRAM_TOKEN): + def __init__(self, token=None): + token = token or dbsettings.TELEGRAM_TOKEN self.bot = telegram.Bot(token=token) def send(self, message, chat_id):