Bugfix
[librarian.git] / src / librarian / dcparser.py
index f402c04..b89abd1 100644 (file)
@@ -18,11 +18,11 @@ from librarian.meta.types.bool import BoolValue
 from librarian.meta.types.date import DateValue
 from librarian.meta.types.person import Person
 from librarian.meta.types.wluri import WLURI
 from librarian.meta.types.date import DateValue
 from librarian.meta.types.person import Person
 from librarian.meta.types.wluri import WLURI
-from librarian.meta.types.text import TextValue
+from librarian.meta.types import text
 
 
 class Field(object):
 
 
 class Field(object):
-    def __init__(self, uri, attr_name, value_type=TextValue,
+    def __init__(self, uri, attr_name, value_type=text.TextValue,
                  multiple=False, salias=None, **kwargs):
         self.uri = uri
         self.name = attr_name
                  multiple=False, salias=None, **kwargs):
         self.uri = uri
         self.name = attr_name
@@ -237,7 +237,6 @@ class WorkInfo(six.with_metaclass(DCInfo, object)):
         for field in self.FIELDS:
             value = field.validate(dc_fields, fallbacks=fallbacks,
                                    strict=strict, validate_required=validate_required)
         for field in self.FIELDS:
             value = field.validate(dc_fields, fallbacks=fallbacks,
                                    strict=strict, validate_required=validate_required)
-            print(field.name, value)
             setattr(self, 'prop_' + field.name, value)
             self.fmap[field.name] = field
             if field.salias:
             setattr(self, 'prop_' + field.name, value)
             self.fmap[field.name] = field
             if field.salias:
@@ -354,17 +353,17 @@ class WorkInfo(six.with_metaclass(DCInfo, object)):
 
 class BookInfo(WorkInfo):
     FIELDS = (
 
 class BookInfo(WorkInfo):
     FIELDS = (
-        Field(DCNS('audience'), 'audiences', salias='audience', multiple=True,
+        Field(DCNS('audience'), 'audiences', text.Audience, salias='audience', multiple=True,
               required=False),
 
               required=False),
 
-        Field(DCNS('subject.period'), 'epochs', salias='epoch', multiple=True,
+        Field(DCNS('subject.period'), 'epochs', text.Epoch, salias='epoch', multiple=True,
               required=False),
               required=False),
-        Field(DCNS('subject.type'), 'kinds', salias='kind', multiple=True,
+        Field(DCNS('subject.type'), 'kinds', text.Kind, salias='kind', multiple=True,
               required=False),
               required=False),
-        Field(DCNS('subject.genre'), 'genres', salias='genre', multiple=True,
+        Field(DCNS('subject.genre'), 'genres', text.Genre, salias='genre', multiple=True,
               required=False),
               required=False),
-        Field(WLNS('category.legimi'), 'legimi', required=False),
-
+        Field(WLNS('category.legimi'), 'legimi', text.LegimiCategory, required=False),
+        Field(WLNS('category.thema'), 'thema', text.ThemaCategory, required=False, multiple=True),
         Field(DCNS('subject.location'), 'location', required=False),
 
         Field(DCNS('contributor.translator'), 'translators',
         Field(DCNS('subject.location'), 'location', required=False),
 
         Field(DCNS('contributor.translator'), 'translators',