mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
cgi.escape is deprecated
This commit is contained in:
parent
fccfdef73d
commit
bc65baeff7
6 changed files with 14 additions and 14 deletions
|
@ -2,7 +2,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import cgi
|
||||
import html
|
||||
|
||||
import unicodedata
|
||||
|
||||
|
@ -125,7 +125,7 @@ class NoteImporter(Importer):
|
|||
for n in notes:
|
||||
for c in range(len(n.fields)):
|
||||
if not self.allowHTML:
|
||||
n.fields[c] = cgi.escape(n.fields[c])
|
||||
n.fields[c] = html.escape(n.fields[c])
|
||||
n.fields[c] = n.fields[c].strip()
|
||||
if not self.allowHTML:
|
||||
n.fields[c] = n.fields[c].replace("\n", "<br>")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Copyright: Andreas Klauer <Andreas.Klauer@metamorpher.de>
|
||||
# License: BSD-3
|
||||
|
||||
import gzip, math, random, time, cgi
|
||||
import gzip, math, random, time, html
|
||||
import xml.etree.ElementTree as ET
|
||||
from anki.importing.noteimp import NoteImporter, ForeignNote, ForeignCard
|
||||
from anki.stdmodels import addForwardReverse
|
||||
|
@ -50,7 +50,7 @@ class PaukerImporter(NoteImporter):
|
|||
front = card.findtext('./FrontSide/Text')
|
||||
back = card.findtext('./ReverseSide/Text')
|
||||
note = ForeignNote()
|
||||
note.fields = [cgi.escape(x.strip()).replace('\n','<br>').replace(' ',' ') for x in [front,back]]
|
||||
note.fields = [html.escape(x.strip()).replace('\n','<br>').replace(' ',' ') for x in [front,back]]
|
||||
notes.append(note)
|
||||
|
||||
# Determine due date for cards.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import re, os, shutil, cgi
|
||||
import re, os, shutil, html
|
||||
from anki.utils import checksum, call, namedtmp, tmpdir, isMac, stripHTML
|
||||
from anki.hooks import addHook
|
||||
from anki.lang import _
|
||||
|
@ -135,7 +135,7 @@ def _errMsg(type, texpath):
|
|||
log = open(namedtmp("latex_log.txt", rm=False)).read()
|
||||
if not log:
|
||||
raise Exception()
|
||||
msg += "<small><pre>" + cgi.escape(log) + "</pre></small>"
|
||||
msg += "<small><pre>" + html.escape(log) + "</pre></small>"
|
||||
except:
|
||||
msg += _("Have you installed latex and dvipng/dvisvgm?")
|
||||
pass
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
|
||||
import sre_constants
|
||||
import cgi
|
||||
import html
|
||||
import time
|
||||
import re
|
||||
from operator import itemgetter
|
||||
|
@ -1740,7 +1740,7 @@ update cards set usn=?, mod=?, did=? where id in """ + scids,
|
|||
t += '''<li><a href=# onclick="pycmd('%s')">%s</a>: %s</a>''' % (
|
||||
"nid:" + ",".join(str(id) for id in nids),
|
||||
ngettext("%d note", "%d notes", len(nids)) % len(nids),
|
||||
cgi.escape(val))
|
||||
html.escape(val))
|
||||
t += "</ol>"
|
||||
t += "</body></html>"
|
||||
web.setHtml(t)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||
import sys, traceback
|
||||
import cgi
|
||||
import html
|
||||
|
||||
from anki.lang import _
|
||||
from aqt.qt import *
|
||||
|
@ -62,7 +62,7 @@ not able to correct them automatically. Please search for 'temp folder' in the \
|
|||
Anki manual for more information.""")
|
||||
|
||||
def onTimeout(self):
|
||||
error = cgi.escape(self.pool)
|
||||
error = html.escape(self.pool)
|
||||
self.pool = ""
|
||||
self.mw.progress.clear()
|
||||
if "abortSchemaMod" in error:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import difflib
|
||||
import re
|
||||
import cgi
|
||||
import html
|
||||
import unicodedata as ucd
|
||||
import html.parser
|
||||
|
||||
|
@ -416,11 +416,11 @@ Please run Tools>Empty Cards""")
|
|||
"Diff-corrects the typed-in answer."
|
||||
givenElems, correctElems = self.tokenizeComparison(given, correct)
|
||||
def good(s):
|
||||
return "<span class=typeGood>"+cgi.escape(s)+"</span>"
|
||||
return "<span class=typeGood>"+html.escape(s)+"</span>"
|
||||
def bad(s):
|
||||
return "<span class=typeBad>"+cgi.escape(s)+"</span>"
|
||||
return "<span class=typeBad>"+html.escape(s)+"</span>"
|
||||
def missed(s):
|
||||
return "<span class=typeMissed>"+cgi.escape(s)+"</span>"
|
||||
return "<span class=typeMissed>"+html.escape(s)+"</span>"
|
||||
if given == correct:
|
||||
res = good(given)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue