BibFormat: migrate to exception logging
- Migrates error logging to new exception-based technique. (addresses #580)
- Creates classes InvenioBibFormatError, InvenioBibFormatWarning, InvenioBibFormatBfxError and InvenioBibFormatBfxWarning .
- Deletes calls to 'get_msgs_for_code_list' and 'register_errors', and add code for these situations.
- Deletes CFG_BIBFORMAT_ERROR_MESSAGES, CFG_BIBFORMAT_WARNING_MESSAGES, CFG_BIBFORMAT_BFX_ERROR_MESSAGES, CFG_BIBFORMAT_BFX_WARNING_MESSAGES vars.
- Deletes 'errors' and warnings vars whenever it is needed.
- Modifies error message for error called 'ERR_BIBFORMAT_CANNOT_READ_TEMPLATE_FILE': 'Could not read format template named'
- Uses function 'string.find(error message)' in the cases where is checked the error code.
- Updates comments of functions.
- Uses python module 'logging' instead of 'print' statements.
- Includes 'req' parameter in calls to 'register_exception' whenever it is available.
- Adds calls to 'gettext_set_language' to translate the exception messages.
- Changes the return value for function 'eval_format_element': (value, []) to (value, dummy)
- In calls to function 'format_with_format_template' remove the access by tuple because of this function does not return a tuple now.
- The same in 'bibformat_engine_tests.py -> test_format_with_format_template, removes access by tuple and removes the line code to check if the result is a tuple because now is returned just one element.