Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-base
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 5a28fb38
authored
Feb 25, 2025
by
Ari Agung Prasetiyo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
_add_view_Config (copy beta-4.2)
1 parent
a3d64342
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
opensipkd/base/__init__.py
opensipkd/base/__init__.py
View file @
5a28fb3
...
@@ -468,6 +468,36 @@ def _set_routes2(config, module="base"):
...
@@ -468,6 +468,36 @@ def _set_routes2(config, module="base"):
return
q
return
q
def
_add_view_config
(
config
,
view_name
,
route
):
if
route
.
get
(
"type"
)
==
0
:
config
.
add_route
(
route
.
get
(
"kode"
),
route
.
get
(
"path"
))
if
route
.
get
(
"nama"
):
titles
[
route
.
get
(
"kode"
)]
=
route
.
get
(
"nama"
)
elif
route
.
get
(
"type"
)
==
1
:
config
.
add_jsonrpc_endpoint
(
route
.
get
(
"kode"
),
route
.
get
(
"path"
),
default_renderer
=
"json_rpc"
)
if
not
route
.
get
(
"def_func"
):
return
class_view
=
route
.
get
(
"class_view"
)
and
f
".{route.get('class_view')}"
or
""
class_name
=
f
"{view_name}{class_view}"
attr
=
f
"view_{route.get('def_func')}"
try
:
_views
=
importlib
.
import_module
(
class_name
)
views
=
_views
if
route
.
get
(
"template"
)
==
"json"
:
renderers
=
route
.
get
(
"template"
)
else
:
renderers
=
"views/templates/"
+
route
.
get
(
"template"
)
params
=
dict
(
attr
=
f
"{attr}"
,
route_name
=
route
.
get
(
"kode"
),
renderer
=
renderers
)
if
route
.
get
(
"permission"
):
params
[
"permission"
]
=
route
.
get
(
"permission"
)
config
.
add_view
(
views
.
Views
,
**
params
)
except
Exception
as
e
:
_logging
.
error
(
str
(
e
))
_logging
.
error
(
route
)
def
add_view_config
(
config
,
module
,
view_name
):
def
add_view_config
(
config
,
module
,
view_name
):
"""
"""
Digunakan untuk mengenerate view_config berdasarkan tabel Routes
Digunakan untuk mengenerate view_config berdasarkan tabel Routes
...
...
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