Skip to content

Commit 4af77b4

Browse files
jalavikegabancho
authored andcommitted
OAIHarvest: resumptionToken fix
* FIX Fixes the parsing of resumptiontoken in incoming OAI-PMH XML which could fail when the resumptiontoken was empty. Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
1 parent 27aa39d commit 4af77b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/oaiharvest/lib/oai_harvest_getter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ def OAI_Session(server, script, http_param_dict , method="POST", output="",
120120

121121
# FIXME We should NOT use regular expressions to parse XML. This works
122122
# for the time being to escape namespaces.
123-
rt_obj = re.search('<.*resumptionToken.*>(.+)</.*resumptionToken.*>',
123+
rt_obj = re.search('<.*resumptionToken.*>(.*)</.*resumptionToken.*>',
124124
harvested_data, re.DOTALL)
125-
if rt_obj is not None and rt_obj != "":
125+
if rt_obj is not None and rt_obj.group(1) != "":
126126
http_param_dict = http_param_resume(http_param_dict, rt_obj.group(1))
127127
i = i + 1
128128
else:

0 commit comments

Comments
 (0)