Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
6cda5fee
Commit
6cda5fee
authored
Sep 06, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix language selection on python3
parent
1fb45d76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
8 deletions
+2
-8
__init__.py
cps/__init__.py
+1
-5
web.py
cps/web.py
+1
-3
No files found.
cps/__init__.py
View file @
6cda5fee
...
...
@@ -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
)
...
...
cps/web.py
View file @
6cda5fee
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment