Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
c5b1b298
Commit
c5b1b298
authored
Sep 12, 2015
by
LE GAC Renaud
Browse files
The MARC12 decoding can return a Record or an Institute class.
parent
7bd56619
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
modules/invenio_tools/marc12.py
modules/invenio_tools/marc12.py
+8
-2
No files found.
modules/invenio_tools/marc12.py
View file @
c5b1b298
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment