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
79f373d4
Commit
79f373d4
authored
Aug 07, 2016
by
cervinko
Committed by
GitHub
Aug 07, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #49 from OzzieIsaacs/patch-2
Fix for non Ascii Characters in database paths #46
parents
df5ab3d2
3b5be5db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
config.py
cps/config.py
+4
-3
db.py
cps/db.py
+1
-1
No files found.
cps/config.py
View file @
79f373d4
...
...
@@ -8,6 +8,7 @@ from configobj import ConfigObj
CONFIG_FILE
=
os
.
path
.
join
(
os
.
getcwd
(),
"config.ini"
)
CFG
=
ConfigObj
(
CONFIG_FILE
)
CFG
.
encoding
=
'UTF-8'
def
CheckSection
(
sec
):
""" Check if INI section exists, if not create it """
...
...
@@ -20,8 +21,8 @@ def CheckSection(sec):
def
check_setting_str
(
config
,
cfg_name
,
item_name
,
def_val
,
log
=
True
):
try
:
my_val
=
config
[
cfg_name
][
item_name
]
if
my_val
==
""
:
my_val
=
config
[
cfg_name
][
item_name
]
.
decode
(
'UTF-8'
)
if
my_val
==
u
""
:
my_val
=
def_val
config
[
cfg_name
][
item_name
]
=
my_val
except
:
...
...
@@ -82,7 +83,7 @@ configval["UPLOADING"] = UPLOADING
configval
[
"ANON_BROWSE"
]
=
ANON_BROWSE
def
save_config
(
configval
):
new_config
=
ConfigObj
()
new_config
=
ConfigObj
(
encoding
=
'UTF-8'
)
new_config
.
filename
=
CONFIG_FILE
new_config
[
'General'
]
=
{}
new_config
[
'General'
][
'DB_ROOT'
]
=
configval
[
"DB_ROOT"
]
...
...
cps/db.py
View file @
79f373d4
...
...
@@ -20,7 +20,7 @@ def title_sort(title):
dbpath
=
os
.
path
.
join
(
config
.
DB_ROOT
,
"metadata.db"
)
engine
=
create_engine
(
'sqlite:///{0}'
.
format
(
dbpath
),
echo
=
False
)
engine
=
create_engine
(
'sqlite:///{0}'
.
format
(
dbpath
.
encode
(
'utf-8'
)
),
echo
=
False
)
conn
=
engine
.
connect
()
conn
.
connection
.
create_function
(
'title_sort'
,
1
,
title_sort
)
Base
=
declarative_base
()
...
...
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