diff --git a/src/irclog2html/irclogsearch.py b/src/irclog2html/irclogsearch.py index 5c8b6e3..07ea7f8 100644 --- a/src/irclog2html/irclogsearch.py +++ b/src/irclog2html/irclogsearch.py @@ -29,13 +29,6 @@ from contextlib import closing from urllib.parse import quote -try: - import cgi - import cgitb -except ImportError: - # Python 3.13 removed all CGI support - cgi = None - from .irclog2html import ( HOMEPAGE, RELEASE, @@ -49,6 +42,14 @@ from .logs2html import find_log_files +try: + import cgi + import cgitb +except ImportError: + # Python 3.13 removed all CGI support + cgi = None + + DEFAULT_LOGFILE_PATH = os.path.dirname(__file__) DEFAULT_LOGFILE_PATTERN = "*.log" diff --git a/src/irclog2html/irclogserver.py b/src/irclog2html/irclogserver.py index 26ad996..2540854 100644 --- a/src/irclog2html/irclogserver.py +++ b/src/irclog2html/irclogserver.py @@ -30,7 +30,7 @@ import os import time from operator import attrgetter -from urllib.parse import quote_plus, parse_qsl +from urllib.parse import parse_qsl, quote_plus from wsgiref.simple_server import make_server from ._version import __date__, __version__ diff --git a/src/irclog2html/tests/test_irclogsearch.py b/src/irclog2html/tests/test_irclogsearch.py index ad30b18..cc23a40 100644 --- a/src/irclog2html/tests/test_irclogsearch.py +++ b/src/irclog2html/tests/test_irclogsearch.py @@ -23,6 +23,7 @@ search_page, ) + try: import cgi except ImportError: