From e694348274fa03a3cd92934b9d4d6c44a3bff7e8 Mon Sep 17 00:00:00 2001 From: Luna Mendes Date: Tue, 13 Nov 2018 15:35:56 -0300 Subject: [PATCH] channel.messages: use args in query_tuple_from_args --- litecord/blueprints/channel/messages.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litecord/blueprints/channel/messages.py b/litecord/blueprints/channel/messages.py index 4e5c7b2..0e12168 100644 --- a/litecord/blueprints/channel/messages.py +++ b/litecord/blueprints/channel/messages.py @@ -29,19 +29,20 @@ def extract_limit(request, default: int = 50): def query_tuple_from_args(args: dict, limit: int) -> tuple: + """Extract a 2-tuple out of request arguments.""" before, after = None, None if 'around' in request.args: average = int(limit / 2) - around = int(request.args['around']) + around = int(args['around']) after = around - average before = around + average - elif 'before' in request.args: - before = int(request.args['before']) - elif 'after' in request.args: - before = int(request.args['after']) + elif 'before' in args: + before = int(args['before']) + elif 'after' in args: + before = int(args['after']) return before, after