Forgot to include this in the last commit

This commit is contained in:
Kovid Goyal 2017-05-01 13:03:08 +05:30
parent 40bbe91c0c
commit fb4ea11ce2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -25,6 +25,7 @@ def human_readable(size, precision=2):
""" Convert a size in bytes into megabytes """ """ Convert a size in bytes into megabytes """
return ('%.'+str(precision)+'f'+ 'MB') % ((size/(1024.*1024.)),) return ('%.'+str(precision)+'f'+ 'MB') % ((size/(1024.*1024.)),)
NULL_VALUES = { NULL_VALUES = {
'user_metadata': {}, 'user_metadata': {},
'cover_data' : (None, None), 'cover_data' : (None, None),
@ -48,6 +49,7 @@ def reset_field_metadata():
global field_metadata global field_metadata
field_metadata = FieldMetadata() field_metadata = FieldMetadata()
ck = lambda typ: icu_lower(typ).strip().replace(':', '').replace(',', '') ck = lambda typ: icu_lower(typ).strip().replace(':', '').replace(',', '')
cv = lambda val: val.strip().replace(',', '|') cv = lambda val: val.strip().replace(',', '|')
@ -72,6 +74,7 @@ class Metadata(object):
Please keep the method based API of this class to a minimum. Every method Please keep the method based API of this class to a minimum. Every method
becomes a reserved field name. becomes a reserved field name.
''' '''
__calibre_serializable__ = True
def __init__(self, title, authors=(_('Unknown'),), other=None, template_cache=None, def __init__(self, title, authors=(_('Unknown'),), other=None, template_cache=None,
formatter=None): formatter=None):
@ -824,6 +827,3 @@ def field_from_string(field, raw, field_metadata):
if val is object: if val is object:
val = raw val = raw
return val return val