Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 154aa7d6
authored
Aug 23, 2022
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
create static path
1 parent
0046a7f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
opensipkd/tools/__init__.py
opensipkd/tools/__init__.py
View file @
154aa7d
...
...
@@ -1012,5 +1012,17 @@ def set_user_log(message, request, logobj=None, user_name=None):
logobj
.
warning
(
message
)
def
create_static_path
(
config
,
folder
,
url
,
cache_max_age
=
3600
):
log
.
debug
(
"Folder to create:
%
s"
,
folder
)
if
not
os
.
path
.
exists
(
folder
):
try
:
os
.
makedirs
(
folder
)
except
Exception
as
e
:
log
.
debug
(
"User:
%
s"
,
os
.
path
.
expanduser
(
"~"
))
log
.
debug
(
"Error:
%
s"
,
str
(
e
))
config
.
add_static_view
(
url
,
path
=
folder
,
cache_max_age
=
cache_max_age
)
def
includeme
(
config
):
config
.
add_translation_dirs
(
'opensipkd.tools:locale/'
)
Write
Preview
Markdown
is supported
Attach a file
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 post a comment