from datetime import date
import time
-from librarian import ValidationError, NoDublinCore, ParseError, DCNS, RDFNS
+from librarian import (ValidationError, NoDublinCore, ParseError, DCNS, RDFNS,
+ WLURI)
import lxml.etree as etree # ElementTree API using libxml2
from lxml.etree import XMLSyntaxError
Field( DCNS('subject.period'), 'epochs', salias='epoch', multiple=True),
Field( DCNS('subject.type'), 'kinds', salias='kind', multiple=True),
Field( DCNS('subject.genre'), 'genres', salias='genre', multiple=True),
+ Field( DCNS('audience'), 'audiences', salias='audience', multiple=True,
+ required=False),
Field( DCNS('date'), 'created_at', as_date),
Field( DCNS('date.pd'), 'released_to_public_domain_at', as_date, required=False),
Field( DCNS('contributor.editor'), 'editors', \
Field( DCNS('relation.hasPart'), 'parts', 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 self.url.rsplit('/', 1)[1]
+ return WLURI(self.url).slug
@classmethod
def from_string(cls, xml):