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 50ea681f
authored
Dec 02, 2024
by
aa.gusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
eselon
1 parent
07a9c8c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
opensipkd/base/__init__.py
opensipkd/base/scripts/initializedb.py
opensipkd/base/views/eselon.py
opensipkd/base/__init__.py
View file @
50ea681
...
...
@@ -417,7 +417,7 @@ def get_urls(url):
if
home
:
urls
=
url
.
split
(
":"
)
homes
=
home
.
split
(
":"
)
if
len
(
urls
)
>
0
:
if
len
(
urls
)
>
1
:
if
urls
[
0
]
!=
homes
[
0
]:
return
":"
.
join
([
homes
[
0
],
":"
.
join
(
urls
[
1
:])])
else
:
...
...
opensipkd/base/scripts/initializedb.py
View file @
50ea681
...
...
@@ -85,16 +85,17 @@ def usage(argv):
def
create_schema
(
engine
,
schema
):
sql
=
select
(
text
(
'schema_name'
))
.
select_from
(
text
(
'information_schema.schemata'
))
.
where
(
text
(
"schema_name = '
%
s'"
%
schema
))
if
isinstance
(
engine
.
dialect
,
oracle
.
dialect
):
sql
=
select
([
'owner'
])
.
select_from
(
'dba_segments'
)
.
where
(
"owner = '
%
s'"
%
schema
.
upper
())
# sql = select(text('schema_name')).select_from(
# text('information_schema.schemata')).where(
# text("schema_name = '%s'" % schema))
# if isinstance(engine.dialect, oracle.dialect):
# sql = select(['owner']).select_from('dba_segments').where(
# "owner = '%s'" % schema.upper())
# log.debug(sql)
with
engine
.
connect
()
as
conn
:
q
=
conn
.
execute
(
sql
)
if
not
q
.
fetchone
():
conn
.
execute
(
CreateSchema
(
schema
)
)
sql
=
CreateSchema
(
schema
,
if_not_exists
=
True
)
log
.
debug
(
f
"Execute: {sql}"
)
conn
.
execute
(
sql
)
def
read_file
(
filename
):
...
...
opensipkd/base/views/eselon.py
View file @
50ea681
...
...
@@ -6,7 +6,6 @@ from pyramid.view import (
view_config
,
)
from
.partner_base
import
NamaSchema
from
opensipkd.models
import
(
DBSession
,
Eselon
...
...
@@ -27,6 +26,7 @@ class AddSchema(colander.Schema):
oid
=
"nama"
)
status
=
colander
.
SchemaNode
(
colander
.
Boolean
(),
widget
=
widget
.
CheckboxWidget
(
true_val
=
1
,
false_val
=
0
),
oid
=
"status"
)
...
...
@@ -35,8 +35,9 @@ class EditSchema(AddSchema):
missing
=
colander
.
drop
,
widget
=
widget
.
HiddenWidget
())
class
ListSchema
(
colander
.
Schema
):
id
=
colander
.
SchemaNode
(
colander
.
String
(),
title
=
"Action"
)
id
=
colander
.
SchemaNode
(
colander
.
String
(),
title
=
"Action"
)
kode
=
colander
.
SchemaNode
(
colander
.
String
(),
validator
=
colander
.
Length
(
max
=
32
),
...
...
@@ -48,10 +49,11 @@ class ListSchema(colander.Schema):
validator
=
colander
.
Length
(
max
=
64
),
oid
=
"nama"
)
status
=
colander
.
SchemaNode
(
colander
.
Integer
(),
colander
.
Boolean
(),
widget
=
widget
.
CheckboxWidget
(),
oid
=
"status"
)
class
Views
(
BaseView
):
def
__init__
(
self
,
request
):
super
(
Views
,
self
)
.
__init__
(
request
)
...
...
@@ -112,6 +114,7 @@ class Views(BaseView):
permission
=
'eselon'
)
def
view_add
(
self
):
return
super
()
.
view_add
()
@view_config
(
route_name
=
'eselon-edit'
,
renderer
=
'templates/form.pt'
,
permission
=
'eselon'
)
def
view_edit
(
self
):
...
...
@@ -164,4 +167,4 @@ class Views(BaseView):
if
found
and
found
.
id
!=
eselon
.
id
:
err_nama
()
elif
found
:
err_nama
()
err_nama
()
\ No newline at end of file
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