Skip to content

news.py: Fixed error when using Python 3.8 or later

Thorbjørn Lindeijer requested to merge fix-news-python3 into master

cgi.escape was removed in favour of html.escape:

bjorn@thor:tmwa-server-data$ make news
tools/news.py world/map/ world/map/news.d/
Traceback (most recent call last):
  File "/home/bjorn/playground/tmwa-server-data/tools/news.py", line 195, in <module>
    main(*sys.argv[1:])
  File "/home/bjorn/playground/tmwa-server-data/tools/news.py", line 190, in main
    s.put(e, entry[:-len(suffix)])
  File "/home/bjorn/playground/tmwa-server-data/tools/news.py", line 78, in put
    entry = entry.format(**colors.make_html_colors_dict())
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bjorn/playground/tmwa-server-data/tools/_news_colors.py", line 54, in __format__
    target = cgi.escape(target, True)
             ^^^^^^^^^^
AttributeError: module 'cgi' has no attribute 'escape'
make: *** [GNUmakefile:35: world/map/news.txt] Error 1

Merge request reports