Pubmed search appears to work in command line output, but document metadata is not updated
Bug #196174 reported by
Charlotte Curtis
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Referencer |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I added a random pdf that I had on my hard drive, and from the command line output it seemed to retrieve the data from Pubmed. However, the document metadata was not updated. I attached a copy of the command line output, but I'm not sure if I'm allowed to upload the PDF (since it is not freely available). If you think it's okay/necessary, I'll upload the article as well.
Changed in referencer: | |
milestone: | none → 1.2.0 |
Changed in referencer: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The <MedLinePgn/> element was confusing the pubmed's parsing code. Looks like it's a pre-print article and thus doesn't have a page number, but they for some reason put that tag in there anyway.
Regardless, I have committed a fix to the parsing code to tolerate this situation.
Index: plugins/pubmed.py ======= ======= ======= ======= ======= ======= ======= ======= ====
return "" .childNodes[ 0].data. encode( "utf-8" ) 0].childNodes) == 0): .childNodes[ 0].data. encode( "utf-8" )
=======
--- plugins/pubmed.py (revision 705)
+++ plugins/pubmed.py (revision 706)
@@ -73,7 +73,10 @@
if len(value) == 0:
else:
- return value[0]
+ if (len(value[
+ return ""
+ else:
+ return value[0]
def text_output(xml):
output. append (["pages", pages])
@@ -131,7 +134,7 @@
pages = get_field (xmldoc, "MedlinePgn")
- output2 = [];
output2. append( pair)
elif (method == "pubmed"):
xml = get_citation_ from_pmid (doc.get_field ("pmid")) py:resolve_ metadata: Got no metadata"
return False
+ output2 = []
for pair in output:
if len(pair[1]) > 0:
@@ -145,12 +148,14 @@
except:
+ print "pubmed.
# Couldn't get any metadata
try:
items = text_output (xml) py:resolve_ metadata: Couldn't parse metadata"
return False
except:
+ print "pubmed.
# Couldn't parse XML