dc:language support
[librarian.git] / librarian / __init__.py
index 0074ee9..619650d 100644 (file)
@@ -6,7 +6,13 @@
 import os
 
 class ParseError(Exception):
-    pass
+    def __str__(self):
+        """ Dirty workaround for Python Unicode handling problems. """
+        return self.message.message
+
+    def __unicode__(self):
+        """ Dirty workaround for Python Unicode handling problems. """
+        return self.message.message
 
 class ValidationError(Exception):
     pass
@@ -87,6 +93,7 @@ DEFAULT_BOOKINFO = dcparser.BookInfo(
           DCNS('subject.type'): [u'Unknown'],
           DCNS('subject.genre'): [u'Unknown'],
           DCNS('date'): ['1970-01-01'],
+          DCNS('language'): [u'pol'],
           # DCNS('date'): [creation_date],
           DCNS('publisher'): [u"Fundacja Nowoczesna Polska"],
           DCNS('description'):
@@ -130,3 +137,7 @@ SERIALIZERS = {
 
 def serialize_children(element, format='raw'):
     return SERIALIZERS[format](element)
+
+def get_resource(path):
+    return os.path.join(os.path.dirname(__file__), path)
+