Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Owo Sugiana
/
opensipkd-base
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6a32e82c
authored
Oct 01, 2020
by
Owo Sugiana
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Akhiri dependency URL dengan .git agar dipahami git client lama
1 parent
c4b347cd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
28 deletions
opensipkd/base/models/ziggurat.py
opensipkd/base/tools/restore.py
opensipkd/base/tools/waktu.py
setup.py
opensipkd/base/models/ziggurat.py
View file @
6a32e82
...
@@ -13,12 +13,14 @@ from ziggurat_foundations.models.base import BaseModel
...
@@ -13,12 +13,14 @@ from ziggurat_foundations.models.base import BaseModel
from
ziggurat_foundations.models.external_identity
import
ExternalIdentityMixin
from
ziggurat_foundations.models.external_identity
import
ExternalIdentityMixin
from
ziggurat_foundations.models.group
import
GroupMixin
from
ziggurat_foundations.models.group
import
GroupMixin
from
ziggurat_foundations.models.group_permission
import
GroupPermissionMixin
from
ziggurat_foundations.models.group_permission
import
GroupPermissionMixin
from
ziggurat_foundations.models.group_resource_permission
import
GroupResourcePermissionMixin
from
ziggurat_foundations.models.group_resource_permission
\
import
GroupResourcePermissionMixin
from
ziggurat_foundations.models.resource
import
ResourceMixin
from
ziggurat_foundations.models.resource
import
ResourceMixin
from
ziggurat_foundations.models.user
import
UserMixin
from
ziggurat_foundations.models.user
import
UserMixin
from
ziggurat_foundations.models.user_group
import
UserGroupMixin
from
ziggurat_foundations.models.user_group
import
UserGroupMixin
from
ziggurat_foundations.models.user_permission
import
UserPermissionMixin
from
ziggurat_foundations.models.user_permission
import
UserPermissionMixin
from
ziggurat_foundations.models.user_resource_permission
import
UserResourcePermissionMixin
from
ziggurat_foundations.models.user_resource_permission
\
import
UserResourcePermissionMixin
from
ziggurat_foundations
import
ziggurat_model_init
from
ziggurat_foundations
import
ziggurat_model_init
from
.
import
(
from
.
import
(
Base
,
Base
,
...
@@ -32,6 +34,8 @@ ziggurat_foundations.models.DBSession = DBSession
...
@@ -32,6 +34,8 @@ ziggurat_foundations.models.DBSession = DBSession
# optional for folks who pass request.db to model methods
# optional for folks who pass request.db to model methods
# Base is sqlalchemy's Base = declarative_base() from your project
# Base is sqlalchemy's Base = declarative_base() from your project
class
Group
(
GroupMixin
,
Base
,
CommonModel
):
class
Group
(
GroupMixin
,
Base
,
CommonModel
):
pass
pass
...
@@ -84,25 +88,6 @@ class User(UserMixin, Base, CommonModel):
...
@@ -84,25 +88,6 @@ class User(UserMixin, Base, CommonModel):
class
ExternalIdentity
(
ExternalIdentityMixin
,
Base
):
class
ExternalIdentity
(
ExternalIdentityMixin
,
Base
):
pass
pass
# you can define multiple resource derived models to build a complex
# application like CMS, forum or other permission based solution
#class Entry(Resource):
# """
# Resource of `entry` type
# """
# __tablename__ = 'entries'
# __mapper_args__ = {'polymorphic_identity': 'entry'}
# resource_id = sa.Column(sa.Integer(),
# sa.ForeignKey('resources.resource_id',
# onupdate='CASCADE',
# ondelete='CASCADE', ),
# primary_key=True, )
# ... your own properties....
# some_property = sa.Column(sa.UnicodeText())
class
RootFactory
:
class
RootFactory
:
def
__init__
(
self
,
request
):
def
__init__
(
self
,
request
):
...
@@ -115,7 +100,7 @@ class RootFactory:
...
@@ -115,7 +100,7 @@ class RootFactory:
self
.
__acl__
.
append
((
Allow
,
acl_name
,
gp
.
perm_name
))
self
.
__acl__
.
append
((
Allow
,
acl_name
,
gp
.
perm_name
))
#ziggurat_model_init(User, Group, UserGroup, GroupPermission, passwordmanager=None)
ziggurat_model_init
(
ziggurat_model_init
(
User
,
Group
,
UserGroup
,
GroupPermission
,
UserPermission
,
User
,
Group
,
UserGroup
,
GroupPermission
,
UserPermission
,
UserResourcePermission
,
GroupResourcePermission
,
Resource
,
UserResourcePermission
,
GroupResourcePermission
,
Resource
,
ExternalIdentity
,
passwordmanager
=
None
)
ExternalIdentity
,
passwordmanager
=
None
)
opensipkd/base/tools/restore.py
View file @
6a32e82
opensipkd/base/tools/waktu.py
View file @
6a32e82
...
@@ -12,15 +12,17 @@ def get_timezone():
...
@@ -12,15 +12,17 @@ def get_timezone():
return
pytz
.
timezone
(
settings
[
'timezone'
])
return
pytz
.
timezone
(
settings
[
'timezone'
])
def
create_datetime
(
year
,
month
,
day
,
hour
=
0
,
minute
=
7
,
second
=
0
,
def
create_datetime
(
microsecond
=
0
):
year
,
month
,
day
,
hour
=
0
,
minute
=
7
,
second
=
0
,
microsecond
=
0
):
tz
=
get_timezone
()
tz
=
get_timezone
()
return
datetime
(
year
,
month
,
day
,
hour
,
minute
,
second
,
return
datetime
(
microsecond
,
tzinfo
=
tz
)
year
,
month
,
day
,
hour
,
minute
,
second
,
microsecond
,
tzinfo
=
tz
)
def
create_date
(
year
,
month
,
day
):
def
create_date
(
year
,
month
,
day
):
return
create_datetime
(
year
,
month
,
day
)
return
create_datetime
(
year
,
month
,
day
)
def
as_timezone
(
tz_date
):
def
as_timezone
(
tz_date
):
localtz
=
get_timezone
()
localtz
=
get_timezone
()
if
not
tz_date
.
tzinfo
:
if
not
tz_date
.
tzinfo
:
...
@@ -34,6 +36,7 @@ def create_now():
...
@@ -34,6 +36,7 @@ def create_now():
tz
=
get_timezone
()
tz
=
get_timezone
()
return
datetime
.
now
(
tz
)
return
datetime
.
now
(
tz
)
def
date_from_str
(
value
):
def
date_from_str
(
value
):
separator
=
None
separator
=
None
value
=
value
.
split
()[
0
]
# dd-mm-yyyy HH:MM:SS
value
=
value
.
split
()[
0
]
# dd-mm-yyyy HH:MM:SS
...
@@ -50,12 +53,15 @@ def date_from_str(value):
...
@@ -50,12 +53,15 @@ def date_from_str(value):
y
,
m
,
d
=
int
(
value
[:
4
]),
int
(
value
[
4
:
6
]),
int
(
value
[
6
:])
y
,
m
,
d
=
int
(
value
[:
4
]),
int
(
value
[
4
:
6
]),
int
(
value
[
6
:])
return
date
(
y
,
m
,
d
)
return
date
(
y
,
m
,
d
)
def
dmy
(
tgl
):
def
dmy
(
tgl
):
return
tgl
.
strftime
(
'
%
d-
%
m-
%
Y'
)
return
tgl
.
strftime
(
'
%
d-
%
m-
%
Y'
)
def
dmyhms
(
t
):
def
dmyhms
(
t
):
return
t
.
strftime
(
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
return
t
.
strftime
(
'
%
d-
%
m-
%
Y
%
H:
%
M:
%
S'
)
def
next_month
(
year
,
month
):
def
next_month
(
year
,
month
):
if
month
==
12
:
if
month
==
12
:
month
=
1
month
=
1
...
@@ -64,6 +70,7 @@ def next_month(year, month):
...
@@ -64,6 +70,7 @@ def next_month(year, month):
month
+=
1
month
+=
1
return
year
,
month
return
year
,
month
def
best_date
(
year
,
month
,
day
):
def
best_date
(
year
,
month
,
day
):
try
:
try
:
return
date
(
year
,
month
,
day
)
return
date
(
year
,
month
,
day
)
...
@@ -71,6 +78,7 @@ def best_date(year, month, day):
...
@@ -71,6 +78,7 @@ def best_date(year, month, day):
last_day
=
calendar
.
monthrange
(
year
,
month
)[
1
]
last_day
=
calendar
.
monthrange
(
year
,
month
)[
1
]
return
date
(
year
,
month
,
last_day
)
return
date
(
year
,
month
,
last_day
)
def
next_month_day
(
year
,
month
,
day
):
def
next_month_day
(
year
,
month
,
day
):
year
,
month
=
next_month
(
year
,
month
)
year
,
month
=
next_month
(
year
,
month
)
return
best_date
(
year
,
month
,
day
)
return
best_date
(
year
,
month
,
day
)
setup.py
View file @
6a32e82
...
@@ -24,7 +24,8 @@ requires = [
...
@@ -24,7 +24,8 @@ requires = [
'ziggurat_foundations'
,
'ziggurat_foundations'
,
'psycopg2-binary'
,
'psycopg2-binary'
,
'pyramid'
,
'pyramid'
,
'opensipkd-jsonrpc @ git+https://git.opensipkd.com/sugiana/opensipkd-jsonrpc'
,
'opensipkd-jsonrpc @ '
'git+https://git.opensipkd.com/sugiana/opensipkd-jsonrpc.git'
,
]
]
...
...
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