replace cgi.escape with html.escape everywhere
cgi.escape is deprecated
This commit is contained in:
parent
635c2e1800
commit
3c58c27b2c
|
@ -17,7 +17,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import cgi
|
||||
import html
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
@ -161,7 +161,7 @@ class gPodderApplication(Gtk.Application):
|
|||
copyright=gpodder.__copyright__,
|
||||
license=gpodder.__license__,
|
||||
bugs_url='https://github.com/gpodder/gpodder/issues',
|
||||
url=cgi.escape(gpodder.__url__),
|
||||
url=html.escape(gpodder.__url__),
|
||||
tr_website=_('Website'),
|
||||
tr_bugtracker=_('Bug Tracker')).strip().split('\n')))
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#
|
||||
|
||||
|
||||
import cgi
|
||||
import html
|
||||
import logging
|
||||
import os
|
||||
|
||||
|
@ -52,11 +52,11 @@ class DirectoryPodcastsModel(Gtk.ListStore):
|
|||
self.clear()
|
||||
for entry in directory_entries:
|
||||
if entry.subscribers != -1:
|
||||
self.append((False, '%s (%d)\n<small>%s</small>' % (cgi.escape(entry.title),
|
||||
entry.subscribers, cgi.escape(entry.url)), entry.title, entry.url))
|
||||
self.append((False, '%s (%d)\n<small>%s</small>' % (html.escape(entry.title),
|
||||
entry.subscribers, html.escape(entry.url)), entry.title, entry.url))
|
||||
else:
|
||||
self.append((False, '%s\n<small>%s</small>' % (cgi.escape(entry.title),
|
||||
cgi.escape(entry.url)), entry.title, entry.url))
|
||||
self.append((False, '%s\n<small>%s</small>' % (html.escape(entry.title),
|
||||
html.escape(entry.url)), entry.title, entry.url))
|
||||
self.callback_can_subscribe(len(self.get_selected_podcasts()) > 0)
|
||||
|
||||
def toggle(self, path):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import cgi
|
||||
import html
|
||||
import logging
|
||||
import urllib.parse
|
||||
|
||||
|
@ -338,13 +338,13 @@ class gPodderPreferences(BuilderWidget):
|
|||
for category, container in sorted(convert(
|
||||
gpodder.user_extensions.get_extensions()), key=key_func):
|
||||
if old_category != category:
|
||||
label = '<span weight="bold">%s</span>' % cgi.escape(category)
|
||||
label = '<span weight="bold">%s</span>' % html.escape(category)
|
||||
self.extensions_model.append((None, label, None, False))
|
||||
old_category = category
|
||||
|
||||
label = '%s\n<small>%s</small>' % (
|
||||
cgi.escape(container.metadata.title),
|
||||
cgi.escape(container.metadata.description))
|
||||
html.escape(container.metadata.title),
|
||||
html.escape(container.metadata.description))
|
||||
self.extensions_model.append((container.enabled, label, container, True))
|
||||
|
||||
self.treeviewExtensions.set_model(self.extensions_model)
|
||||
|
@ -432,7 +432,7 @@ class gPodderPreferences(BuilderWidget):
|
|||
# This is one ugly hack, but it displays the attributes of
|
||||
# the metadata object of the container..
|
||||
info = '\n'.join('<b>%s:</b> %s' %
|
||||
tuple(map(cgi.escape, list(map(str, (key, value)))))
|
||||
tuple(map(html.escape, list(map(str, (key, value)))))
|
||||
for key, value in container.metadata.get_sorted())
|
||||
|
||||
self.show_message(info, _('Extension module info'), important=True)
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
# Based on code from gpodder.services (thp, 2007-08-24)
|
||||
#
|
||||
|
||||
import cgi
|
||||
import collections
|
||||
import html
|
||||
import threading
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
@ -55,8 +55,8 @@ class DownloadStatusModel(Gtk.ListStore):
|
|||
self._status_ids[download.DownloadTask.PAUSED] = 'media-playback-pause'
|
||||
|
||||
def _format_message(self, episode, message, podcast):
|
||||
episode = cgi.escape(episode)
|
||||
podcast = cgi.escape(podcast)
|
||||
episode = html.escape(episode)
|
||||
podcast = html.escape(podcast)
|
||||
return '%s\n<small>%s - %s</small>' % (episode, message, podcast)
|
||||
|
||||
def request_update(self, iter, task=None):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import cgi
|
||||
import html
|
||||
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
@ -82,9 +82,9 @@ class gPodderConfigEditor(BuilderWidget):
|
|||
|
||||
if not self._config.update_field(name, new_text):
|
||||
message = _('Cannot set %(field)s to %(value)s. Needed data type: %(datatype)s')
|
||||
d = {'field': cgi.escape(name),
|
||||
'value': cgi.escape(new_text),
|
||||
'datatype': cgi.escape(type_cute)}
|
||||
d = {'field': html.escape(name),
|
||||
'value': html.escape(new_text),
|
||||
'datatype': html.escape(type_cute)}
|
||||
self.notification(message % d, _('Error setting option'))
|
||||
|
||||
def value_toggled(self, renderer, path):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#
|
||||
|
||||
|
||||
import cgi
|
||||
import html
|
||||
|
||||
from gi.repository import GObject, Gtk
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TagCloud(Gtk.Layout):
|
|||
|
||||
for tag, weight in tags:
|
||||
label = Gtk.Label()
|
||||
markup = '<span size="%d">%s</span>' % (1000 * self._scale(weight), cgi.escape(tag))
|
||||
markup = '<span size="%d">%s</span>' % (1000 * self._scale(weight), html.escape(tag))
|
||||
label.set_markup(markup)
|
||||
button = Gtk.ToolButton(label)
|
||||
button.connect('clicked', lambda b, t: self.emit('selected', t), tag)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Based on code from libpodcasts.py (thp, 2005-10-29)
|
||||
#
|
||||
|
||||
import cgi
|
||||
import html
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
@ -54,8 +54,8 @@ class GEpisode(model.PodcastEpisode):
|
|||
|
||||
@property
|
||||
def title_markup(self):
|
||||
return '%s\n<small>%s</small>' % (cgi.escape(self.title),
|
||||
cgi.escape(self.channel.title))
|
||||
return '%s\n<small>%s</small>' % (html.escape(self.title),
|
||||
html.escape(self.channel.title))
|
||||
|
||||
@property
|
||||
def markup_new_episodes(self):
|
||||
|
@ -65,10 +65,10 @@ class GEpisode(model.PodcastEpisode):
|
|||
length_str = ''
|
||||
return ('<b>%s</b>\n<small>%s' + _('released %s') +
|
||||
'; ' + _('from %s') + '</small>') % (
|
||||
cgi.escape(re.sub('\s+', ' ', self.title)),
|
||||
cgi.escape(length_str),
|
||||
cgi.escape(self.pubdate_prop),
|
||||
cgi.escape(re.sub('\s+', ' ', self.channel.title)))
|
||||
html.escape(re.sub('\s+', ' ', self.title)),
|
||||
html.escape(length_str),
|
||||
html.escape(self.pubdate_prop),
|
||||
html.escape(re.sub('\s+', ' ', self.channel.title)))
|
||||
|
||||
@property
|
||||
def markup_delete_episodes(self):
|
||||
|
@ -83,11 +83,11 @@ class GEpisode(model.PodcastEpisode):
|
|||
downloaded_string = _('today')
|
||||
return ('<b>%s</b>\n<small>%s; %s; ' + _('downloaded %s') +
|
||||
'; ' + _('from %s') + '</small>') % (
|
||||
cgi.escape(self.title),
|
||||
cgi.escape(util.format_filesize(self.file_size)),
|
||||
cgi.escape(played_string),
|
||||
cgi.escape(downloaded_string),
|
||||
cgi.escape(self.channel.title))
|
||||
html.escape(self.title),
|
||||
html.escape(util.format_filesize(self.file_size)),
|
||||
html.escape(played_string),
|
||||
html.escape(downloaded_string),
|
||||
html.escape(self.channel.title))
|
||||
|
||||
|
||||
class GPodcast(model.PodcastChannel):
|
||||
|
@ -274,20 +274,20 @@ class EpisodeListModel(Gtk.ListStore):
|
|||
|
||||
if episode.state != gpodder.STATE_DELETED and episode.is_new:
|
||||
yield '<b>'
|
||||
yield cgi.escape(title)
|
||||
yield html.escape(title)
|
||||
yield '</b>'
|
||||
else:
|
||||
yield cgi.escape(title)
|
||||
yield html.escape(title)
|
||||
|
||||
if include_description:
|
||||
yield '\n'
|
||||
if self._all_episodes_view:
|
||||
yield _('from %s') % cgi.escape(episode.channel.title)
|
||||
yield _('from %s') % html.escape(episode.channel.title)
|
||||
else:
|
||||
description = episode.one_line_description()
|
||||
if description.startswith(title):
|
||||
description = description[len(title):].strip()
|
||||
yield cgi.escape(description)
|
||||
yield html.escape(description)
|
||||
|
||||
def replace_from_channel(self, channel, include_description=False):
|
||||
"""
|
||||
|
@ -712,11 +712,11 @@ class PodcastListModel(Gtk.ListStore):
|
|||
|
||||
def _format_description(self, channel, total, deleted,
|
||||
new, downloaded, unplayed):
|
||||
title_markup = cgi.escape(channel.title)
|
||||
title_markup = html.escape(channel.title)
|
||||
if not channel.pause_subscription:
|
||||
description_markup = cgi.escape(util.get_first_line(channel.description) or ' ')
|
||||
description_markup = html.escape(util.get_first_line(channel.description) or ' ')
|
||||
else:
|
||||
description_markup = cgi.escape(_('Subscription paused'))
|
||||
description_markup = html.escape(_('Subscription paused'))
|
||||
d = []
|
||||
if new:
|
||||
d.append('<span weight="bold">')
|
||||
|
@ -854,7 +854,7 @@ class PodcastListModel(Gtk.ListStore):
|
|||
# We could customized the section header here with the list
|
||||
# of channels and their stats (i.e. add some "new" indicator)
|
||||
description = '<span size="16000"> </span><b>%s</b>' % (
|
||||
cgi.escape(section))
|
||||
html.escape(section))
|
||||
|
||||
self.set(
|
||||
iter,
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
# Thomas Perl <thp@gpodder.org> 2009-03-31
|
||||
#
|
||||
|
||||
import cgi
|
||||
import html
|
||||
|
||||
from gi.repository import Gdk, GObject, Gtk, Pango
|
||||
|
||||
|
@ -46,7 +46,7 @@ class SimpleMessageArea(Gtk.HBox):
|
|||
self.__label.set_alignment(0.0, 0.5)
|
||||
self.__label.set_line_wrap(False)
|
||||
self.__label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||
self.__label.set_markup('<b>%s</b>' % cgi.escape(message))
|
||||
self.__label.set_markup('<b>%s</b>' % html.escape(message))
|
||||
self.pack_start(self.__label, True, True, 0)
|
||||
|
||||
hbox = Gtk.HBox()
|
||||
|
|
Loading…
Reference in New Issue