Commit c5b1b298 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

The MARC12 decoding can return a Record or an Institute class.

parent 7bd56619
......@@ -5,7 +5,9 @@
import re
from base import is_institute
from exception import Marc12Exception
from institute import Institute
from record import Record
from xml.dom.minidom import parseString
......@@ -242,7 +244,8 @@ class Marc12(object):
return True
def __call__(self, xml, filter=None, func=None):
"""Transform the the XML string into a list of L{Record}.
"""Transform the the XML string into a list of L{Record}
or L{Institute}
@type xml: unicode
@param xml: the XML string has the following structure::
......@@ -275,7 +278,7 @@ class Marc12(object):
The argument of the function is a Record.
It can be used to polish the record content.
@rtype: list of L{Record}
@rtype: list of L{Record} or L{Institute}
@raise Marc12Exception: not well formed XML.
......@@ -292,6 +295,9 @@ class Marc12(object):
record = self._decode_record(node)
self._clean_record(record)
if is_institute(record):
record = Institute(record)
if filter and not filter(record):
continue
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment