[alacarte: 1/2] MainWindow: Use html.escape.
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte: 1/2] MainWindow: Use html.escape.
- Date: Tue, 11 Feb 2020 17:45:30 +0000 (UTC)
commit 85ad095c1a9684353eb9605b818bd33ac6997fb0
Author: Lubosz Sarnecki <lubosz gmail com>
Date: Sat Feb 8 01:19:00 2020 +0100
MainWindow: Use html.escape.
Python 3.2 deprecated and 3.8 removes the escape function from the cgi module.
The official documentation states to use html.escape as replacement.
This makes Alacarte work with Python 3 for me.
As @muktupavels pointed out the default parameter for the quote option
has changed when moving from cgi to html. This patch sets quote to
False, keeping the parameter name for better readibility.
See:
https://docs.python.org/3.7/library/cgi.html#cgi.escape
https://docs.python.org/3.8/library/html.html#html.escape
Alacarte/MainWindow.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index 69aefa8..403017b 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -22,7 +22,7 @@ gi.require_version('GMenu', '3.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GdkPixbuf, Gdk, GMenu
import sys
-import cgi
+import html
import os
import gettext
import shutil
@@ -205,7 +205,7 @@ class MainWindow(object):
def loadMenu(self, iters, parent=None):
for menu, show in self.editor.getMenus(parent):
- name = cgi.escape(menu.get_name())
+ name = html.escape(menu.get_name(), quote=False)
icon = util.getIcon(menu)
iters[menu] = self.menu_store.append(iters[parent], (icon, name, menu))
@@ -224,7 +224,7 @@ class MainWindow(object):
else:
assert False, 'should not be reached'
- name = cgi.escape(name)
+ name = html.escape(name, quote=False)
self.item_store.append((show, icon, name, item))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]