E-book Edit: Fix importing DOCX file as new book not setting the version attribute in the OPF

This commit is contained in:
Kovid Goyal 2017-01-12 09:33:19 +05:30
parent b0de1b61ef
commit 692022e3b3

View File

@ -37,6 +37,8 @@ class PrettyPrint(object):
def __exit__(self, *args): def __exit__(self, *args):
global pretty_print_opf global pretty_print_opf
pretty_print_opf = False pretty_print_opf = False
pretty_print = PrettyPrint() pretty_print = PrettyPrint()
@ -1570,6 +1572,7 @@ class OPFCreator(Metadata):
guide guide
) )
root.set('unique-identifier', __appname__+'_id') root.set('unique-identifier', __appname__+'_id')
root.set('version', '2.0')
raw = etree.tostring(root, pretty_print=True, xml_declaration=True, raw = etree.tostring(root, pretty_print=True, xml_declaration=True,
encoding=encoding) encoding=encoding)
raw = raw.replace(DNS, OPF2_NS) raw = raw.replace(DNS, OPF2_NS)
@ -1835,6 +1838,7 @@ def test_user_metadata():
assert um == opf2._user_metadata_ assert um == opf2._user_metadata_
print opf.render() print opf.render()
if __name__ == '__main__': if __name__ == '__main__':
# test_user_metadata() # test_user_metadata()
test_m2o() test_m2o()