X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/b6ec0976a383cc1823f4a199bc3e6dc40880b049..4077ffb3cbd868df95239898563508b64e6d6ecf:/librarian/dcparser.py diff --git a/librarian/dcparser.py b/librarian/dcparser.py index 5492f7a..992029e 100644 --- a/librarian/dcparser.py +++ b/librarian/dcparser.py @@ -141,18 +141,14 @@ class BookInfo(object): Field( DCNS('publisher'), 'publisher'), Field( DCNS('source'), 'source_name', required=False), Field( DCNS('source.URL'), 'source_url', required=False), - Field( DCNS('identifier.url'), 'url'), - Field( DCNS('relation.hasPart'), 'parts', multiple=True, required=False), + Field( DCNS('identifier.url'), 'url', WLURI), + Field( DCNS('relation.hasPart'), 'parts', WLURI, multiple=True, required=False), Field( DCNS('rights.license'), 'license', required=False), Field( DCNS('rights'), 'license_description'), Field( DCNS('language'), 'language'), Field( DCNS('description'), 'description', required=False), ) - @property - def slug(self): - return WLURI(self.url).slug - @classmethod def from_string(cls, xml): from StringIO import StringIO @@ -216,6 +212,11 @@ class BookInfo(object): self.fmap[field.name] = field if field.salias: self.fmap[field.salias] = field + self.validate() + + def validate(self): + self.url.validate_language(self.language) + def __getattribute__(self, name): try: field = object.__getattribute__(self, 'fmap')[name]