Hi.

I'm working on allowing the global replacement of displayed record IDs
by an external system number (e.g. arXiv ID or bibcode). For this I
need to import search_engine.get_fieldvalues in some modules but can't
do that because of the problem of reciprocal imports (search_engine
import module and module import search_engine). Here is a patch that
moves this sensitive function to a new file that I called
search_engine_utils. I don't have a strong opinion on the name nor the
location of this file.

An advantage of doing this is that we can get rid of the multiple
implementations of get_fieldvalues() available in Invenio:

modules/bibformat/lib/bibformat_dblayer.py:def get_fieldvalues(recID, tag):
modules/bibformat/lib/bibformat_utils.py:    def get_fieldvalues(recID, tag):
modules/bibindex/lib/bibindex_engine.py:def get_fieldvalues(recID, tag):
modules/bibrank/lib/bibrank_downloads_similarity.py:def
get_fieldvalues(recID, tag):
modules/websearch/lib/search_engine.py:def get_fieldvalues(recIDs,
tag, repetitive_values=True):
modules/websearch/lib/websearch_templates.py:def get_fieldvalues(recID, tag):

Let me know if this is something that is beneficial to Invenio and/or
what could be added to this new module.

Cheers.

-- 
Benoit Thiell
Software developer
The SAO/NASA Astrophysics Data System
http://adswww.harvard.edu/

Attachment: 0001-Merge-multiple-implementations-of-get_fieldvalues.patch
Description: Binary data

Reply via email to