From e34a843077f2b0fcfd6aaff3812c0ac7d2c589ee Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 5 May 2024 21:53:13 +1200 Subject: [PATCH] no need to check for existing of route param --- web.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/web.py b/web.py index f46590b..303a3b5 100644 --- a/web.py +++ b/web.py @@ -169,17 +169,11 @@ class ReticulumWebChat: async def index(request): # get path params - destination_hash = request.match_info.get("destination_hash", None) + destination_hash = request.match_info.get("destination_hash", "") # get source hash from local lxmf destination source_hash = self.local_lxmf_destination.hash.hex() - # destination_hash is required - if destination_hash is None: - return web.json_response({ - "message": "destination_hash is required", - }, status=422) - # get lxmf messages from db where "source to destination" or "destination to source" and ordered by oldest to newest db_lxmf_messages = (database.LxmfMessage.select() .where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash)) @@ -215,17 +209,11 @@ class ReticulumWebChat: async def index(request): # get path params - destination_hash = request.match_info.get("destination_hash", None) + destination_hash = request.match_info.get("destination_hash", "") # get source hash from local lxmf destination source_hash = self.local_lxmf_destination.hash.hex() - # destination_hash is required - if destination_hash is None: - return web.json_response({ - "message": "destination_hash is required", - }, status=422) - # delete lxmf messages from db where "source to destination" or "destination to source" (database.LxmfMessage.delete() .where((database.LxmfMessage.source_hash == source_hash) & (database.LxmfMessage.destination_hash == destination_hash))