[PATCH eac] Attempt for parsing date text value in maintenanceEvent tag

Guillaume Vandevelde guillaume.vandevelde at logilab.fr
Thu Sep 5 10:17:32 CEST 2019


# HG changeset patch
# User Guillaume Vandevelde <gvandevelde at logilab.fr>
# Date 1567154801 -7200
#      Fri Aug 30 10:46:41 2019 +0200
# Node ID c8e0063ce829c00dbb7df916e525406c285b87e1
# Parent  23b2a95297e707d62a235f20324445e8ae255c06
# Available At http://hg.logilab.org/review/cubes/eac
#              hg pull http://hg.logilab.org/review/cubes/eac -r c8e0063ce829
Attempt for parsing date text value in maintenanceEvent tag

diff -r 23b2a95297e7 -r c8e0063ce829 cubicweb_eac/dataimport.py
--- a/cubicweb_eac/dataimport.py	Thu Aug 08 15:18:23 2019 +0200
+++ b/cubicweb_eac/dataimport.py	Fri Aug 30 10:46:41 2019 +0200
@@ -1109,6 +1109,16 @@
                 else:
                     values['start'] = set([event_date])
                     values['end'] = set([event_date])
+            else:
+                try:
+                    event_date = parse_date(date.text)
+                except ValueError:
+                    self.import_log.record_warning(
+                        self._('could not parse raw date from %s') % etree.tostring(date),
+                        line=date.sourceline)
+                else:
+                    values['start'] = set([event_date])
+                    values['end'] = set([event_date])
         values.update(self.parse_tag_description(elem, 'eac:eventDescription'))
         values.update(self.values_from_xpaths(elem, (('agent', 'eac:agent'),)))
         agent_type = self._elem_find(elem, 'eac:agentType')



More information about the saem-devel mailing list