mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #7590 (server crash when use chinese create a user category)
This commit is contained in:
parent
730f510e24
commit
c996a001a7
@ -7,7 +7,6 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import operator, os, json, re
|
import operator, os, json, re
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import hexlify, unhexlify
|
||||||
from urllib import quote, unquote
|
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
@ -21,6 +20,7 @@ from calibre.utils.magick import Image
|
|||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
from calibre.library.server import custom_fields_to_display
|
from calibre.library.server import custom_fields_to_display
|
||||||
from calibre.library.field_metadata import category_icon_map
|
from calibre.library.field_metadata import category_icon_map
|
||||||
|
from calibre.library.server.utils import quote, unquote
|
||||||
|
|
||||||
def render_book_list(ids, prefix, suffix=''): # {{{
|
def render_book_list(ids, prefix, suffix=''): # {{{
|
||||||
pages = []
|
pages = []
|
||||||
|
@ -6,10 +6,11 @@ __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import time, sys
|
import time, sys
|
||||||
|
from urllib import quote as quote_, unquote as unquote_
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
from calibre import strftime as _strftime, prints
|
from calibre import strftime as _strftime, prints, isbytestring
|
||||||
from calibre.utils.date import now as nowf
|
from calibre.utils.date import now as nowf
|
||||||
from calibre.utils.config import tweaks
|
from calibre.utils.config import tweaks
|
||||||
|
|
||||||
@ -81,3 +82,14 @@ def format_tag_string(tags, sep, ignore_max=False, no_tag_count=False):
|
|||||||
return u'%s:&:%s'%(tweaks['max_content_server_tags_shown'],
|
return u'%s:&:%s'%(tweaks['max_content_server_tags_shown'],
|
||||||
', '.join(tlist)) if tlist else ''
|
', '.join(tlist)) if tlist else ''
|
||||||
|
|
||||||
|
def quote(s):
|
||||||
|
if isinstance(s, unicode):
|
||||||
|
s = s.encode('utf-8')
|
||||||
|
return quote_(s)
|
||||||
|
|
||||||
|
def unquote(s):
|
||||||
|
ans = unquote_(s)
|
||||||
|
if isbytestring(ans):
|
||||||
|
ans = ans.decode('utf-8')
|
||||||
|
return ans
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user