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 5c179c78
authored
Feb 24, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
_add_view_Config
1 parent
d65b84ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
opensipkd/base/__init__.py
opensipkd/base/__init__.py
View file @
5c179c7
...
@@ -467,6 +467,37 @@ def _set_routes2(config, module="base"):
...
@@ -467,6 +467,37 @@ def _set_routes2(config, module="base"):
route
.
kode
,
route
.
path
,
default_renderer
=
"json_rpc"
)
route
.
kode
,
route
.
path
,
default_renderer
=
"json_rpc"
)
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
):
"""
"""
...
...
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