Commits

"Jas...@ubib.eur.nl>"  committed 3ed3569

added nl_mods, and make didl use nl_mods instead of mods.
It is identical, but uses other date encoding

  • Participants
  • Parent commits f6359e0

Comments (0)

Files changed (3)

File moai/metadata/didl.py

 
 from lxml.builder import ElementMaker
 
-from moai.metadata.mods import MODS, XSI_NS
+from moai.metadata.mods import NL_MODS, XSI_NS
 
         
 class DIDL(object):
 
         # generate mods for this feed
         mods_data = DIDL.Resource(mimeType="application/xml")
-        MODS('mods', self.config, self.db)(mods_data, metadata)
+        NL_MODS('mods', self.config, self.db)(mods_data, metadata)
 
         asset_data = []
 

File moai/metadata/mods.py

         
         element.append(mods)
 
+class NL_MODS(MODS):
+    """
+    like mods, but dateIssued uses wrong iso8601 encoding instead of w3cdtf
+    """
+    def __init__(self, prefix, config, db):
+        super(NL_MODS, self).__init__(prefix, config, db)
+        self.ns['nl_mods'] = self.ns['mods']
+        self.schemas['nl_mods'] = self.schemas['mods']
+        
+    def __call__(self, element, metadata):
+        super(NL_MODS, self).__call__(element, metadata)
+        for el in element.xpath(
+            './mods:mods/mods:originInfo/'
+            'mods:dateIssued[@encoding="w3cdtf"]', namespaces=self.ns):
+            el.attrib['encoding'] = 'iso8601'
+        
+        
     'moai.format':[
          'oai_dc=moai.metadata.oaidc:OAIDC',
          'mods=moai.metadata.mods:MODS',
+         'nl_mods=moai.metadata.mods:NL_MODS',
          'didl=moai.metadata.didl:DIDL',
          'nl_didl=moai.metadata.dare_didl:DareDIDL'
      ],