From: Marek Stępniowski Date: Sat, 6 Sep 2008 13:34:44 +0000 (+0200) Subject: Added converter string_to_unicode_list to dcparser. Added handling of 'identifier... X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/84857c8e944af74ee5904db84149ab2ceef8bfef Added converter string_to_unicode_list to dcparser. Added handling of 'identifier.url' and 'relation.hasPart' tags. --- diff --git a/lib/dcparser/converters.py b/lib/dcparser/converters.py index b49c41735..85e41534b 100644 --- a/lib/dcparser/converters.py +++ b/lib/dcparser/converters.py @@ -30,6 +30,13 @@ def str_to_unicode(value, previous): return unicode(value) +def str_to_unicode_list(value, previous): + if previous is None: + previous = [] + previous.append(str_to_unicode(value)) + return previous + + def str_to_person(value, previous): comma_count = value.count(',') diff --git a/lib/dcparser/dcparser.py b/lib/dcparser/dcparser.py index 5df7700c1..7d4386237 100644 --- a/lib/dcparser/dcparser.py +++ b/lib/dcparser/dcparser.py @@ -57,6 +57,8 @@ class BookInfo(object): DC('publisher') : ('publisher', converters.str_to_unicode), DC('source') : ('source_name', converters.str_to_unicode), DC('source.URL') : ('source_url', converters.str_to_unicode), + DC('identifier.url') : ('url', converters.str_to_unicode), + DC('relation.hasPart') : ('parts', converters.str_to_unicode_list), } @classmethod