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
13c2a53c
Commit
13c2a53c
authored
Aug 19, 2017
by
Jonathan Rehm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues with Windows path separators
parent
a27848b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
cache_buster.py
cps/cache_buster.py
+3
-2
No files found.
cps/cache_buster.py
View file @
13c2a53c
...
@@ -14,7 +14,7 @@ def init_cache_busting(app):
...
@@ -14,7 +14,7 @@ def init_cache_busting(app):
because whenever the resource changes, so does its URL.
because whenever the resource changes, so does its URL.
"""
"""
static_folder
=
app
.
static_folder
# the rooted path to the static file folder
static_folder
=
os
.
path
.
join
(
app
.
static_folder
,
''
)
# path to the static file folder, with trailing slash
hash_table
=
{}
# map of file hashes
hash_table
=
{}
# map of file hashes
...
@@ -28,7 +28,8 @@ def init_cache_busting(app):
...
@@ -28,7 +28,8 @@ def init_cache_busting(app):
version
=
hashlib
.
md5
(
f
.
read
())
.
hexdigest
()[:
7
]
version
=
hashlib
.
md5
(
f
.
read
())
.
hexdigest
()[:
7
]
# save version to tables
# save version to tables
file_path
=
rooted_filename
.
replace
(
static_folder
+
"/"
,
""
)
file_path
=
rooted_filename
.
replace
(
static_folder
,
""
)
file_path
=
file_path
.
replace
(
"
\\
"
,
"/"
)
# Convert Windows path to web path
hash_table
[
file_path
]
=
version
hash_table
[
file_path
]
=
version
app
.
logger
.
debug
(
'Finished computing cache-busting values'
)
app
.
logger
.
debug
(
'Finished computing cache-busting values'
)
...
...
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