Skip to content

Commit

Permalink
Python: Switch cgi.escape to html.escape
Browse files Browse the repository at this point in the history
Fixes #8962

Unlike cgi.escape, html.escape defaults to quote=True and also escapes quotes.
This is OK with Pango though.
  • Loading branch information
clefebvre committed Nov 16, 2019
1 parent 9cc821b commit 058e3a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Expand Up @@ -21,7 +21,7 @@
gi.require_version('Gtk', '3.0')
gi.require_version('CMenu', '3.0')
from gi.repository import Gtk, GObject, Gio, GdkPixbuf, Gdk, CMenu, GLib
import cgi
import html
import os
import gettext
import subprocess
Expand Down Expand Up @@ -209,7 +209,7 @@ def loadMenus(self):

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())
if not show:
name = "<small><i>%s</i></small>" % (name,)

Expand All @@ -230,7 +230,7 @@ def loadItems(self, menu):
else:
assert False, 'should not be reached'

name = cgi.escape(name)
name = html.escape(name)
if not show:
name = "<small><i>%s</i></small>" % (name,)

Expand Down
Expand Up @@ -4,7 +4,7 @@
import os
import re
import json
import cgi
import html
import subprocess
import gettext
from html.parser import HTMLParser
Expand Down Expand Up @@ -95,7 +95,7 @@ def show_prompt(msg, window=None):
message_type = Gtk.MessageType.QUESTION,
buttons = Gtk.ButtonsType.YES_NO)
dialog.set_default_size(400, 200)
esc = cgi.escape(msg)
esc = html.escape(msg)
dialog.set_markup(esc)
dialog.show_all()
response = dialog.run()
Expand Down
4 changes: 2 additions & 2 deletions files/usr/share/cinnamon/cinnamon-settings/bin/Spices.py
Expand Up @@ -8,7 +8,7 @@
import sys
import zipfile
import shutil
import cgi
import html
import subprocess
import threading
import time
Expand Down Expand Up @@ -729,7 +729,7 @@ def _ui_error_message(self, msg, detail = None):
markup = msg
if detail is not None:
markup += _("\n\nDetails: %s") % (str(detail))
esc = cgi.escape(markup)
esc = html.escape(markup)
dialog.set_markup(esc)
dialog.show_all()
response = dialog.run()
Expand Down
@@ -1,7 +1,7 @@
#!/usr/bin/python3

from gi.repository import Gio, Gtk, GObject, Gdk
import cgi
import html
import gettext

import gi
Expand Down Expand Up @@ -480,7 +480,7 @@ def onEntryChanged(self, cell, path, accel_string, accel_label, entry_store):
msg = _("This key combination, <b>%(combination)s</b> is currently in use by <b>%(old)s</b>. ")
msg += _("If you continue, the combination will be reassigned to <b>%(new)s</b>.\n\n")
msg += _("Do you want to continue with this operation?")
dialog.set_markup(msg % {'combination':cgi.escape(accel_label), 'old':cgi.escape(keybinding.label), 'new':cgi.escape(current_keybinding.label)})
dialog.set_markup(msg % {'combination':html.escape(accel_label), 'old':html.escape(keybinding.label), 'new':html.escape(current_keybinding.label)})
dialog.show_all()
response = dialog.run()
dialog.destroy()
Expand Down

0 comments on commit 058e3a1

Please sign in to comment.