mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-05 23:32:46 -06:00
Restores using OcrConfig for the moment
This commit is contained in:
@@ -10,6 +10,7 @@ from django.utils import timezone
|
|||||||
from documents.plugins.date_parsing.base import DateParserConfig
|
from documents.plugins.date_parsing.base import DateParserConfig
|
||||||
from documents.plugins.date_parsing.base import DateParserPluginBase
|
from documents.plugins.date_parsing.base import DateParserPluginBase
|
||||||
from documents.plugins.date_parsing.regex_parser import RegexDateParserPlugin
|
from documents.plugins.date_parsing.regex_parser import RegexDateParserPlugin
|
||||||
|
from paperless.config import OcrConfig
|
||||||
from paperless.utils import ocr_to_dateparser_languages
|
from paperless.utils import ocr_to_dateparser_languages
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -74,9 +75,9 @@ def get_date_parser() -> DateParserPluginBase:
|
|||||||
|
|
||||||
# 2. Load configuration from settings
|
# 2. Load configuration from settings
|
||||||
# TODO: Get the language from the settings and/or configuration object, depending
|
# TODO: Get the language from the settings and/or configuration object, depending
|
||||||
languages = languages = (
|
ocr_config = OcrConfig()
|
||||||
settings.DATE_PARSER_LANGUAGES
|
languages = settings.DATE_PARSER_LANGUAGES or ocr_to_dateparser_languages(
|
||||||
or ocr_to_dateparser_languages(settings.OCR_LANGUAGE)
|
ocr_config.language,
|
||||||
)
|
)
|
||||||
|
|
||||||
config = DateParserConfig(
|
config = DateParserConfig(
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ class TestDiscoverParserClass:
|
|||||||
mock_entry_points.assert_called_once()
|
mock_entry_points.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.django_db
|
||||||
@pytest.mark.date_parsing
|
@pytest.mark.date_parsing
|
||||||
@pytest.mark.usefixtures("mock_date_parser_settings")
|
@pytest.mark.usefixtures("mock_date_parser_settings")
|
||||||
class TestGetDateParser:
|
class TestGetDateParser:
|
||||||
|
|||||||
Reference in New Issue
Block a user