Use html.escape instead of the deprecated cgi.escape

This commit is contained in:
Tomas Groth 2015-04-02 21:32:20 +01:00
parent f8b575065a
commit 589bc98bec
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ Some of the code for this form is based on the examples at:
"""
import cgi
import html
import logging
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
@ -273,7 +273,7 @@ class MainDisplay(OpenLPMixin, Display, RegistryProperties):
"""
# First we convert <>& marks to html variants, then apply
# formattingtags, finally we double all backslashes for JavaScript.
text_prepared = expand_tags(cgi.escape(text)).replace('\\', '\\\\').replace('\"', '\\\"')
text_prepared = expand_tags(html.escape(text)).replace('\\', '\\\\').replace('\"', '\\\"')
if self.height() != self.screen['size'].height() or not self.isVisible():
shrink = True
js = 'show_alert("%s", "%s")' % (text_prepared, 'top')

View File

@ -55,7 +55,7 @@ The XML of an `OpenLyrics <http://openlyrics.info/>`_ song looks like this::
</lyrics>
</song>
"""
import cgi
import html
import logging
import re
@ -318,7 +318,7 @@ class OpenLyrics(object):
if 'lang' in verse[0]:
verse_element.set('lang', verse[0]['lang'])
# Create a list with all "optional" verses.
optional_verses = cgi.escape(verse[1])
optional_verses = html.escape(verse[1])
optional_verses = optional_verses.split('\n[---]\n')
start_tags = ''
end_tags = ''