#465: BibAuthorID: clean relative vs absolute imports
-------------------------+--------------------------------------------------
 Reporter:  simko        |       Owner:     
     Type:  enhancement  |      Status:  new
 Priority:  minor        |   Milestone:     
Component:  BibAuthorID  |     Version:     
 Keywords:               |  
-------------------------+--------------------------------------------------
 Due to usage of relative imports, one cannot run unit test before
 installing them, as is usual for other modules:

 {{{
 $ python ./bibauthorid_tests.py
 Traceback (most recent call last):
   File "./bibauthorid_tests.py", line 21, in <module>
     import bibauthorid_tables_utils as baidtu
   File
 
"/home/simko/private/src/invenio/modules/bibauthorid/lib/bibauthorid_tables_utils.py",
 line 30, in <module>
     from search_engine import get_record
 ImportError: No module named search_engine
 }}}

 If relative imports are wanted e.g. to be able to run BibAuthorID on
 grid node where Invenio is not installed, then it may be interesting
 to introduce conditional imports that will attempt to import needed
 modules from local scope and in case of ImportError from global scope,
 kind of like:

 {{{
 try:
     from search_engine import get_record
 except ImportError:
     from invenio.search_engine import get_record
 }}}

-- 
Ticket URL: <http://invenio-software.org/ticket/465>
Invenio <http://invenio-software.org>

Reply via email to