X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/6641219fd962fc1791fa8d94dec26db4c3546931..3eeb653bf9948d69c8290fd453b638bb783ab084:/src/librarian/dcparser.py diff --git a/src/librarian/dcparser.py b/src/librarian/dcparser.py index 16c2397..1976850 100644 --- a/src/librarian/dcparser.py +++ b/src/librarian/dcparser.py @@ -153,6 +153,9 @@ def as_unicode(text): else: return TextPlus(text.decode('utf-8')) +def as_bool(text): + return text == 'true' +as_bool.no_lang = True def as_wluri_strict(text): return WLURI.strict(text) @@ -203,7 +206,7 @@ class Field(object): if validator is None or val[0] is None: return val[0] nv = validator(val[0]) - if hasattr(val[0], 'lang'): + if hasattr(val[0], 'lang') and not hasattr(validator, 'no_lang'): setattr(nv, 'lang', val[0].lang) return nv except ValueError as e: @@ -527,6 +530,8 @@ class BookInfo(WorkInfo): Field(WLNS('coverClass'), 'cover_class', default=['default']), Field(WLNS('coverLogoUrl'), 'cover_logo_urls', multiple=True, required=False), + Field(WLNS('endnotes'), 'endnotes', as_bool, + required=False), Field('pdf-id', 'isbn_pdf', required=False), Field('epub-id', 'isbn_epub', required=False),