fix for xmlmarc records with empty fields
authorArt Rhyno <art632000@yahoo.ca>
Sat, 16 Jun 2012 23:51:12 +0000 (19:51 -0400)
committerArt Rhyno <art632000@yahoo.ca>
Sat, 16 Jun 2012 23:51:12 +0000 (19:51 -0400)
conifer/libsystems/marcxml.py

index 0f828a1..9cfb4e4 100644 (file)
@@ -28,7 +28,8 @@ def record_to_dictionary(rec, multiples=True):
     dct = {}
     for cf in tree.findall('{http://www.loc.gov/MARC21/slim}controlfield'):
         t = cf.attrib['tag']
-        dct.setdefault(t, []).append(cf.text)
+        if not cf.text is None:
+           dct.setdefault(t, []).append(cf.text)
     for df in tree.findall('{http://www.loc.gov/MARC21/slim}datafield'):
         t = df.attrib['tag']
         for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):