Roundup Tracker - Issues

Issue 2551123

classification
Validate indexer_language in config module rather than in indexer_xapian.py
Type: behavior Severity: normal
Components: Database Versions: devel, 2.1.0
process
Status: fixed fixed
:
: rouilj : rouilj
Priority: high :

Created on 2021-03-29 03:53 by rouilj, last changed 2021-03-30 02:52 by rouilj.

Messages
msg7149 Author: [hidden] (rouilj) Date: 2021-03-29 03:53
In hg 6353:9d209d2b34ae the value of the config
main.indexer_language setting is validated in
indexer_xapian.py.

A bad language setting results in an error when loading any web
page (and probably a failure from the email gateway).
It should probably be validated in configuration.py.

To do this, we need:

 1) determine if the xapian indexer is being used.
 2) determine if the language is valid by calling:
    xapian.Stem(language). A xapian.InvalidArgumentError
    indicates a bad language.
 3) report to the user the error and the list of good languages.
    See current implementation in backends/indexer_xapian.py.

1 is tricky. If [main] indexer is unset or set to xapian, we need
to test the config value. But there is no guarantee that
the [main] indexer definition will be available when we need to
validate the indexer_language.
msg7156 Author: [hidden] (rouilj) Date: 2021-03-30 02:52
Fixed in hg 6356:c26b9ce33ae3.

One glitch is that the error technically should throw an
OptionValueError. However there is no good way to get the
object required to use that exception because the test
has to occur outside of the Options application framework.

So I just throw a ValueError like the former implementation
in indexer_xapian.py.

This version does exit on startup rather than on first access so
a win nonetheless.
History
Date User Action Args
2021-03-30 02:52:01rouiljsetpriority: high
assignee: rouilj
status: new -> fixed
messages: + msg7156
resolution: fixed
2021-03-29 03:53:10rouiljcreate