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 423c6830
authored
Sep 20, 2025
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add route configuration functions for compatibility; refactor permission model class
1 parent
ce26f872
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
3 deletions
opensipkd/base/__init__.py
opensipkd/base/models/base.py
opensipkd/base/models/users.py
opensipkd/base/views/base_views.py
opensipkd/base/__init__.py
View file @
423c683
...
...
@@ -21,6 +21,7 @@ from .models.base import DBSession
from
.models.handlers
import
LogDBSession
from
.models.meta
import
Base
from
.models.users
import
init_model
from
.models
import
Route
# from deform import ZPTRendererFactory, Form
# from deform.widget import default_resource_registry
...
...
@@ -676,3 +677,48 @@ def get_params_(params, alternate=None, settings=None):
# else:
# return home + url
# return url
#Depreciated modules
def
_set_routes1
(
config
,
app_id
):
"""Compatibility
"""
q
=
DBSession
.
query
(
Route
)
.
filter
(
Route
.
path
!=
None
,
Route
.
module
==
None
,
Route
.
status
==
1
)
if
not
app_id
:
q
.
filter
(
or_
(
Route
.
app_id
==
0
,
None
==
Route
.
app_id
))
else
:
q
.
filter
(
Route
.
app_id
==
app_id
)
for
route
in
q
:
if
route
.
type
==
0
:
config
.
add_route
(
route
.
kode
,
route
.
path
)
if
route
.
nama
:
titles
[
route
.
kode
]
=
route
.
nama
elif
route
.
type
==
1
:
config
.
add_jsonrpc_endpoint
(
route
.
kode
,
route
.
path
,
default_renderer
=
"json_rpc"
)
def
_set_routes2
(
config
,
module
=
"base"
):
"""Compatibility
"""
q
=
DBSession
.
query
(
Route
)
.
filter
(
Route
.
module
==
module
,
Route
.
status
==
1
)
for
route
in
q
:
if
route
.
type
==
0
:
config
.
add_route
(
route
.
kode
,
route
.
path
)
if
route
.
nama
:
titles
[
route
.
kode
]
=
route
.
nama
elif
route
.
type
==
1
:
config
.
add_jsonrpc_endpoint
(
route
.
kode
,
route
.
path
,
default_renderer
=
"json_rpc"
)
return
q
def
set_routes
(
config
,
app_id
=
None
):
"""Compatibility
"""
if
app_id
and
type
(
app_id
)
==
str
:
return
_set_routes2
(
config
,
app_id
)
else
:
return
_set_routes1
(
config
,
app_id
)
opensipkd/base/models/base.py
View file @
423c683
...
...
@@ -15,7 +15,6 @@ class MySession(Session):
def
execute
(
self
,
clause
,
params
=
None
,
mapper
=
None
,
**
kw
):
return
Session
.
execute
(
self
,
clause
,
params
)
# , mapper
session_factory
=
sessionmaker
(
class_
=
MySession
)
DBSession
=
scoped_session
(
session_factory
)
register
(
DBSession
)
...
...
opensipkd/base/models/users.py
View file @
423c683
...
...
@@ -241,7 +241,7 @@ class ExternalIdentity(Base, _ExternalIdentity, CommonModel):
# groups = relationship("Group", backref=backref('grouppermission'))
class
_Permission
(
Common
Model
):
class
_Permission
(
Default
Model
):
__tablename__
=
'permissions'
__table_args__
=
(
TABLE_ARGS
)
id
=
Column
(
Integer
,
primary_key
=
True
)
...
...
opensipkd/base/views/base_views.py
View file @
423c683
...
...
@@ -1100,7 +1100,8 @@ class BaseView(object):
resources
=
form
.
get_widget_resources
()
form
.
set_appstruct
(
self
.
get_values
(
row
))
kwargs
[
"readonly"
]
=
True
return
self
.
returned_form
(
form
,
table
,
**
kwargs
)
kwargs
[
"table"
]
=
table
return
self
.
returned_form
(
form
,
**
kwargs
)
def
query_id
(
self
,
id
=
None
):
id
=
id
or
self
.
req
.
matchdict
[
'id'
]
...
...
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