[Python-modules-team] Bug#961912: python3-tempita: Tempita HTMLTemplate fails with python3.8 due to cgi.escape

activityworkshop debian at activityworkshop.net
Sun May 31 11:59:34 BST 2020


Package: python3-tempita
Version: 0.5.2-6
Severity: normal
Tags: upstream

Dear Maintainer,

Debian Bullseye has python3.8, in which cgi.escape has been deprecated.
Tempita uses cgi.escape for its HTMLTemplate class, so calls fail with
an AttributeError: module 'cgi' has no attribute 'escape'.

Debian Buster still uses python3.7 so it works there.

This example demonstrates the failure:
    from tempita import HTMLTemplate
    t = HTMLTemplate("Hello {{name}}")
    t.substitute({'name':'Tempita'})

The code causing the AttributeError is in /usr/lib/python3/dist-packages/tempita/__init__.py
and can be patched as follows:

line 34, instead of:
    import cgi
change to:
    from html import escape

lines 448 and 451, instead of:
    cgi.escape(
change to:
    escape(



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 5.6.0-2-amd64 (SMP w/6 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-tempita depends on:
ii  python3  3.8.2-3

python3-tempita recommends no packages.

python3-tempita suggests no packages.

-- no debconf information



More information about the Python-modules-team mailing list