wl style for XeLaTeX is now a class. Accepts several parameters affecting output...
[librarian.git] / librarian / dcparser.py
index e2f91a0..eb6c5ea 100644 (file)
@@ -127,6 +127,8 @@ class BookInfo(object):
         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('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('date'), 'created_at', as_date),
         Field( DCNS('date.pd'), 'released_to_public_domain_at', as_date, required=False),
         Field( DCNS('contributor.editor'), 'editors', \
@@ -268,7 +270,8 @@ class BookInfo(object):
                     if len(v) == 0: continue
                     for x in v:
                         e = etree.Element(field.uri)
                     if len(v) == 0: continue
                     for x in v:
                         e = etree.Element(field.uri)
-                        e.text = unicode(x)
+                        if x is not None:
+                            e.text = unicode(x)
                         description.append(e)
                 else:
                     e = etree.Element(field.uri)
                         description.append(e)
                 else:
                     e = etree.Element(field.uri)
@@ -288,7 +291,7 @@ class BookInfo(object):
             if v is not None:
                 if field.multiple:
                     if len(v) == 0: continue
             if v is not None:
                 if field.multiple:
                     if len(v) == 0: continue
-                    v = [ unicode(x) for x in v if v is not None ]
+                    v = [ unicode(x) for x in v if x is not None ]
                 else:
                     v = unicode(v)
 
                 else:
                     v = unicode(v)
 
@@ -304,7 +307,7 @@ class BookInfo(object):
             if v is not None:
                 if field.multiple:
                     if len(v) == 0: continue
             if v is not None:
                 if field.multiple:
                     if len(v) == 0: continue
-                    v = [ unicode(x) for x in v if v is not None ]
+                    v = [ unicode(x) for x in v if x is not None ]
                 else:
                     v = unicode(v)
                 result[field.name] = v
                 else:
                     v = unicode(v)
                 result[field.name] = v