mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Replace another use of pickle
This commit is contained in:
parent
54ef601e91
commit
52c371e8b5
@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, cPickle
|
||||
import os
|
||||
from functools import partial
|
||||
from binascii import hexlify
|
||||
|
||||
@ -20,6 +20,7 @@ from calibre.utils.icu import sort_key
|
||||
from calibre.utils.formatter import EvalFormatter
|
||||
from calibre.utils.date import is_date_undefined
|
||||
from calibre.utils.localization import calibre_langcode_to_name
|
||||
from calibre.utils.serialize import json_dumps
|
||||
from polyglot.builtins import unicode_type
|
||||
|
||||
default_sort = ('title', 'title_sort', 'authors', 'author_sort', 'series', 'rating', 'pubdate', 'tags', 'publisher', 'identifiers')
|
||||
@ -79,7 +80,7 @@ def author_search_href(which, title=None, author=None):
|
||||
|
||||
|
||||
def item_data(field_name, value, book_id):
|
||||
return hexlify(cPickle.dumps((field_name, value, book_id), -1))
|
||||
return hexlify(json_dumps((field_name, value, book_id)))
|
||||
|
||||
|
||||
def mi_to_html(mi, field_list=None, default_author_link=None, use_roman_numbers=True, rating_font='Liberation Serif', rtl=False):
|
||||
|
@ -2,7 +2,6 @@
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
# License: GPLv3 Copyright: 2010, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import cPickle
|
||||
import os
|
||||
import re
|
||||
from binascii import unhexlify
|
||||
@ -34,6 +33,7 @@ from calibre.gui2.dnd import (
|
||||
from calibre.utils.config import tweaks
|
||||
from calibre.utils.img import blend_image, image_from_x
|
||||
from calibre.utils.localization import is_rtl
|
||||
from calibre.utils.serialize import json_loads
|
||||
from polyglot.builtins import unicode_type
|
||||
|
||||
_css = None
|
||||
@ -286,7 +286,7 @@ def details_context_menu_event(view, ev, book_info): # {{{
|
||||
lambda : book_info.search_requested('authors:"={}"'.format(author.replace('"', r'\"'))))
|
||||
if data:
|
||||
try:
|
||||
field, value, book_id = cPickle.loads(unhexlify(data))
|
||||
field, value, book_id = json_loads(unhexlify(data))
|
||||
except Exception:
|
||||
field = value = book_id = None
|
||||
if field:
|
||||
|
Loading…
x
Reference in New Issue
Block a user