1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed 38f283b

htmlui: use cgi.escape in place of Qt.escape

Qt.escape implicitly upgrades the given string to unicode. Because htmlui
is Mercurial-level API, it should keep str object of local-encoding.

  • Participants
  • Parent commits 4ca096e
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/htmlui.py

View file
  • Ignore whitespace
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2, incorporated herein by reference.
 
-import os, time
+import os, cgi, time
 
 from mercurial import ui
-from PyQt4 import QtCore
 from tortoisehg.hgqt import qtlib
 from tortoisehg.util import hglib
 
 
     def style(self, msg, label):
         'Escape message for safe HTML, then apply specified style'
-        msg = QtCore.Qt.escape(msg)
-        msg = msg.replace('\n', '<br />')
+        msg = cgi.escape(msg).replace('\n', '<br />')
         style = qtlib.geteffect(label)
         return '<span style="%s">%s</span>' % (style, msg)