From 6cda5fee0d7832cf36aad3e8a9ce792d4947023d Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Fri, 6 Sep 2019 20:56:17 +0200 Subject: [PATCH] Fix language selection on python3 --- cps/__init__.py | 6 +----- cps/web.py | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cps/__init__.py b/cps/__init__.py index 72a359f7..abcc4cbb 100755 --- a/cps/__init__.py +++ b/cps/__init__.py @@ -108,7 +108,7 @@ def create_app(): return app @babel.localeselector -def negociate_locale(): +def get_locale(): # if a user is logged in, use the locale from the user settings user = getattr(g, 'user', None) # user = None @@ -128,10 +128,6 @@ def negociate_locale(): return negotiate_locale(preferred or ['en'], _BABEL_TRANSLATIONS) -def get_locale(): - return request._locale - - @babel.timezoneselector def get_timezone(): user = getattr(g, 'user', None) diff --git a/cps/web.py b/cps/web.py index 17f05f0b..a946573e 100644 --- a/cps/web.py +++ b/cps/web.py @@ -44,7 +44,7 @@ from werkzeug.datastructures import Headers from werkzeug.security import generate_password_hash, check_password_hash from . import constants, logger, isoLanguages, services, worker -from . import searched_ids, lm, babel, db, ub, config, negociate_locale, get_locale, app +from . import searched_ids, lm, babel, db, ub, config, get_locale, app from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download from .helper import common_filters, get_search_results, fill_indexpage, speaking_language, check_valid_domain, \ order_authors, get_typeahead, render_task_status, json_serial, get_cc_columns, \ @@ -242,8 +242,6 @@ def render_title_template(*args, **kwargs): @web.before_app_request def before_request(): - # log.debug("before_request: %s %s %r", request.method, request.path, getattr(request, 'locale', None)) - request._locale = negociate_locale() g.user = current_user g.allow_registration = config.config_public_reg g.allow_anonymous = config.config_anonbrowse