Handle code passing an OPF object into db.set_metadata

This commit is contained in:
Kovid Goyal 2010-10-09 07:25:50 -06:00
parent f9bddf4f67
commit 63b72a9b4f

View file

@ -1254,6 +1254,10 @@ def set_metadata(self, id, mi, ignore_errors=False,
'''
Set metadata for the book `id` from the `Metadata` object `mi`
'''
if hasattr(mi, 'to_book_metadata'):
# Handle code passing in a OPF object instead of a Metadata object
mi = mi.to_book_metadata()
def doit(func, *args, **kwargs):
try:
func(*args, **kwargs)