From baadfc000c45bd399217a0c2c035c0791cd5a5a2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 9 Oct 2010 22:59:50 -0600 Subject: [PATCH] ... --- resources/content_server/browse.html | 2 +- src/calibre/library/server/browse.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/content_server/browse.html b/resources/content_server/browse.html index 699d2128bf..a71fff9e22 100644 --- a/resources/content_server/browse.html +++ b/resources/content_server/browse.html @@ -31,7 +31,7 @@ diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index db0775b097..42d3d76dfb 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -10,7 +10,7 @@ import operator, os import cherrypy from calibre.constants import filesystem_encoding -from calibre import isbytestring, force_unicode +from calibre import isbytestring, force_unicode, prepare_string_for_xml as xml class BrowseServer(object): @@ -36,18 +36,20 @@ class BrowseServer(object): if fm[x]['name']] prefix = 'category' if category else 'book' ans = P('content_server/browse.html', data=True) - ans = ans.replace('{sort_select_label}', _('Sort by')+':') - opts = ['' % (prefix, k, n) for k, n in + ans = ans.replace('{sort_select_label}', xml(_('Sort by')+':')) + opts = ['' % (prefix, xml(k), + xml(n)) for k, n in sorted(sort_opts, key=operator.itemgetter(1))] - opts = [''] + opts ans = ans.replace('{sort_select_options}', '\n\t\t\t'.join(opts)) - lp = os.path.basename(self.db.library_path) + lp = self.db.library_path if isbytestring(lp): lp = force_unicode(lp, filesystem_encoding) if isinstance(ans, unicode): ans = ans.encode('utf-8') - ans = ans.replace('{library_name}', lp) + ans = ans.replace('{library_name}', xml(os.path.basename(lp))) + ans = ans.replace('{library_path}', xml(lp, True)) return ans if self.opts.develop: