Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ce5e7b47
authored
Nov 20, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add mobile static path configuration and update upload view for mobile files
1 parent
9d593687
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
CHANGES.txt
opensipkd/base/__init__.py
opensipkd/base/views/upload.py
CHANGES.txt
View file @
ce5e7b4
5.0.2
Menambahkan path static 'mobi' and configuration 'mobile_static_path'
5.0.1
- Bug Saat get captcha session tidak berfungsi dimana ditambahkan checking melalui
file jpg yang tersimpan dalam folder captcha files
...
...
opensipkd/base/__init__.py
View file @
ce5e7b4
...
...
@@ -8,6 +8,7 @@ import datetime
import
decimal
import
deform
import
traceback
import
opensipkd
from
pkg_resources
import
resource_filename
from
pyramid.renderers
import
JSON
from
pyramid_beaker
import
session_factory_from_settings
...
...
@@ -303,9 +304,16 @@ def get_config(settings):
# if not os.path.exists(partner_files):
# os.makedirs(partner_files)
config
.
add_static_view
(
'static'
,
'opensipkd.base:static'
,
cache_max_age
=
3600
)
config
.
add_static_view
(
'static'
,
'opensipkd.base:static'
,
cache_max_age
=
3600
)
mobile_static_path
=
settings
.
get
(
'mobile_static_path'
)
if
not
mobile_static_path
:
mobi_path
=
os
.
path
.
dirname
(
opensipkd
.
base
.
__file__
)
mobile_static_path
=
os
.
path
.
join
(
mobi_path
,
'static'
,
'mobile'
)
if
not
os
.
path
.
exists
(
mobile_static_path
):
mobile_static_path
=
os
.
makedirs
(
mobile_static_path
)
config
.
add_static_view
(
'mobi'
,
mobile_static_path
+
os
.
sep
,
cache_max_age
=
3600
)
config
.
add_static_view
(
'deform_static'
,
'deform:static'
)
# config.add_static_view(partner_idcard_url,
...
...
opensipkd/base/views/upload.py
View file @
ce5e7b4
...
...
@@ -45,7 +45,8 @@ class AddSchema(CSRFSchema):
image_for
=
colander
.
SchemaNode
(
colander
.
String
(),
widget
=
widget
.
SelectWidget
(
values
=
((
'oth'
,
"Other"
),
(
'logo'
,
"Logo"
),
(
'bg'
,
"Background"
))),
(
'bg'
,
"Background"
),
(
'mobile'
,
"Mobile Files"
),)),
title
=
'Peruntukan'
)
...
...
@@ -75,6 +76,14 @@ def view_file(request):
fname
=
f
"logo{ext}"
elif
request
.
POST
[
"image_for"
]
==
"bg"
:
fname
=
f
"background{ext}"
elif
request
.
POST
[
"image_for"
]
==
"mobile"
:
mobile_static_path
=
request
.
registry
.
settings
.
get
(
'mobile_static_path'
,
None
)
if
not
mobile_static_path
:
request
.
session
.
flash
(
"Mobile static path belum dikonfigurasi"
,
'error'
)
return
dict
(
form
=
form
.
render
())
static_path
=
os
.
path
.
join
(
mobile_static_path
)
typ
=
ext
==
'.png'
and
"img"
or
'icon'
folder
=
os
.
path
.
join
(
static_path
,
typ
)
if
not
os
.
path
.
exists
(
folder
):
...
...
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