From 1759c119a8e7eda53da9306cd37a81084e140ea0 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Wed, 1 Mar 2023 09:42:30 -0700 Subject: [PATCH] Replace Python 3.10 `match` with if/else Some distributions require manually installing Python 3.10, which makes it less convenient than just using whatever version of Python3.X the package manager supports. Since the only 3.10 feature being used was "match", and it was a very small change, it's been replaced with an if/else statement to ensure compatibility with older versions of Python 3. --- app/routes.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/routes.py b/app/routes.py index 2c0aa1a..1105e8d 100644 --- a/app/routes.py +++ b/app/routes.py @@ -344,12 +344,10 @@ def search(): # check for widgets and add if requested if search_util.widget != '': html_soup = bsoup(str(response), 'html.parser') - match search_util.widget: - case 'ip': - response = add_ip_card(html_soup, get_client_ip(request)) - case 'calculator': - if not 'nojs' in request.args: - response = add_calculator_card(html_soup) + if search_util.widget == 'ip': + response = add_ip_card(html_soup, get_client_ip(request)) + elif search_util.widget == 'calculator' and not 'nojs' in request.args: + response = add_calculator_card(html_soup) # Update tabs content tabs = get_tabs_content(app.config['HEADER_TABS'],