#572: bibrecord: be defensive in iteration
-----------------------+----------------------
Reporter: jblayloc | Owner: jmartinm
Type: defect | Status: new
Priority: major | Milestone:
Component: BibEdit | Version:
Keywords: bibrecord |
-----------------------+----------------------
We got some exception reports because bibrecord is sometimes trying to do
something with a 'rec' which is, I would guess, empty for some reason. We
get Iteration Over Non-Sequence bubbling up from here:
{{{
>>>> Frame record_xml_output in /usr/lib64/python2.4/site-
packages/invenio/bibrecord.py at line 891
*******************************************************************************
888 889 # Add the tag 'tag' to each field in rec[tag] 890 fields = []
----> 891 for tag in rec: 892 if not tags or tag in tags: 893 for field in
rec[tag]: 894 fields.append((tag, field))
*******************************************************************************
marcxml = "['<record>']" tags = '[]' rec = 'None' fields = '[]'
}}}
See also https://inspirert.cern.ch/Ticket/Display.html?id=122870 which is
the original exception report and full stack trace.
I'm hoping we can just throw an 'if' check in there and be more graceful
about empty recs. But it would be good if we could figure out why they
sometimes happen and decide whether that's a real problem or not.
Javier, if you don't want this feel free to reassign (but *somebody*
probably ought to do it.)
--
Ticket URL: <http://invenio-software.org/ticket/572>
Invenio <http://invenio-software.org>