From 5738b0453ce6d15286489e4e7cd8858ad6064b32 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 3 Jun 2011 15:34:41 -0600 Subject: [PATCH] Escape color templates when redering rules list --- src/calibre/gui2/preferences/coloring.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/preferences/coloring.py b/src/calibre/gui2/preferences/coloring.py index 695adabed8..0fca30695b 100644 --- a/src/calibre/gui2/preferences/coloring.py +++ b/src/calibre/gui2/preferences/coloring.py @@ -12,6 +12,7 @@ from PyQt4.Qt import (QWidget, QDialog, QLabel, QGridLayout, QComboBox, QSize, QScrollArea, QPushButton, QVBoxLayout, QDialogButtonBox, QToolButton, QListView, QAbstractListModel, pyqtSignal, QSizePolicy, QSpacerItem) +from calibre import prepare_string_for_xml from calibre.utils.icu import sort_key from calibre.gui2 import error_dialog from calibre.gui2.dialogs.template_dialog import TemplateDialog @@ -430,7 +431,7 @@ class RulesModel(QAbstractListModel): # {{{ return _('''

Advanced Rule for column %s:

%s
- ''')%(col, rule) + ''')%(col, prepare_string_for_xml(rule)) conditions = [self.condition_to_html(c) for c in rule.conditions] return _('''\

Set the color of %s to %s if the following @@ -439,9 +440,10 @@ class RulesModel(QAbstractListModel): # {{{ ''') % (col, rule.color, ''.join(conditions)) def condition_to_html(self, condition): + c, a, v = condition return ( _('

  • If the %s column %s value: %s') % - tuple(condition)) + (c, a, prepare_string_for_xml(v))) # }}}