X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_librarian%2Fsearch.py;h=82889a8d518e720108d3dc297316a4409c080a69;hb=054ce4ecc6c93d0289864c80677c7dd8bf8b1962;hp=1405e09dac6fe582a7c1ce3f0fd9efbe15cb0021;hpb=5932dd9301f9820b2b103545593606909f8eceb8;p=m_librarian.git diff --git a/m_librarian/search.py b/m_librarian/search.py index 1405e09..82889a8 100644 --- a/m_librarian/search.py +++ b/m_librarian/search.py @@ -1,8 +1,3 @@ -try: - from configparser import NoSectionError, NoOptionError -except ImportError: # Python 2 - from ConfigParser import NoSectionError, NoOptionError - from sqlobject.sqlbuilder import AND, OR, func from .config import get_config from .db import Author, Book, Extension, Genre, Language @@ -80,19 +75,13 @@ def search_books(search_type, case_sensitive, values, join_expressions=None, orderBy=None, use_filters=False): if use_filters: config = get_config() - try: - lang_filter = config.get('filters', 'lang') - except (NoSectionError, NoOptionError): - lang_filter = None - try: - deleted_filter = config.getint('filters', 'deleted') - except (NoSectionError, NoOptionError): - deleted_filter = None + lang_filter = config.getlist('filters', 'lang') + deleted_filter = config.getint('filters', 'deleted') if lang_filter: if join_expressions is None: join_expressions = [] lang_conditions = [] - for lang in lang_filter.split(): + for lang in lang_filter: lvalues = {'name': lang} conditions = mk_search_conditions( Language, search_type, case_sensitive, lvalues)