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.
このコミットが含まれているのは:
Ben Busby 2023-03-01 09:42:30 -07:00
コミット 1759c119a8
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: B9B7231E01D924A1
1個のファイルの変更4行の追加6行の削除

ファイルの表示

@ -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'],