summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bee03d5)
Prepare for Python 3.13 dropping `cgi`.
__copyright__ = "Copyright (C) 2014-2024 PhiloSoft Design"
__license__ = "GNU GPL"
__copyright__ = "Copyright (C) 2014-2024 PhiloSoft Design"
__license__ = "GNU GPL"
+from html import escape
+from urllib.parse import parse_qs
+import os
import sys
from lark import ParseError
import sys
from lark import ParseError
from html.response import redirect, response
from parser import parser
from html.response import redirect, response
from parser import parser
-form = cgi.FieldStorage()
-if 'q' not in form:
+qs_dict = parse_qs(os.environ['QUERY_STRING'], encoding='koi8-r')
+if 'q' not in qs_dict or len(qs_dict['q']) > 1:
status = "400 Bad request"
title = "Error!"
body = "Required parameter is missing!"
else:
status = "400 Bad request"
title = "Error!"
body = "Required parameter is missing!"
else:
try:
tree = parser.parse(q)
except ParseError:
try:
tree = parser.parse(q)
except ParseError:
from tags import find_tags
posts = find_tags(tree)
status = None
from tags import find_tags
posts = find_tags(tree)
status = None
- title = "Записи, найденные для выражения " + cgi.escape(q)
+ title = "Записи, найденные для выражения " + escape(q)
if posts:
_posts = ["""\
<p class="head">
if posts:
_posts = ["""\
<p class="head">