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 f7e42dc6
authored
Aug 29, 2024
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Perbaikan exception saat upload
1 parent
a975ba98
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
opensipkd/base/views/base_views.py
opensipkd/models/base.py
opensipkd/base/views/base_views.py
View file @
f7e42dc
import
logging
import
logging
import
os
import
os
import
re
import
re
import
traceback
from
datetime
import
datetime
from
datetime
import
datetime
from
email.utils
import
parseaddr
from
email.utils
import
parseaddr
...
@@ -353,7 +354,13 @@ class BaseView(object):
...
@@ -353,7 +354,13 @@ class BaseView(object):
break
break
output_file
.
write
(
data
)
output_file
.
write
(
data
)
output_file
.
close
()
output_file
.
close
()
try
:
self
.
save_upload
(
fullpath
,
delimiter
=
delimiter
)
self
.
save_upload
(
fullpath
,
delimiter
=
delimiter
)
except
Exception
as
e
:
self
.
req
.
session
.
flash
(
str
(
e
),
'error'
)
return
dict
(
form
=
form
.
render
(),
scripts
=
self
.
form_scripts
,
css
=
resources
[
"css"
],
js
=
resources
[
"js"
])
elif
"cancel"
in
self
.
req
.
POST
or
'batal'
in
self
.
req
.
POST
or
"close"
in
self
.
req
.
POST
:
elif
"cancel"
in
self
.
req
.
POST
or
'batal'
in
self
.
req
.
POST
or
"close"
in
self
.
req
.
POST
:
self
.
cancel_act
()
self
.
cancel_act
()
...
@@ -580,8 +587,8 @@ class BaseView(object):
...
@@ -580,8 +587,8 @@ class BaseView(object):
self
.
req
.
session
.
flash
(
msg
,
'error'
)
self
.
req
.
session
.
flash
(
msg
,
'error'
)
return
self
.
route_list
(
**
kwargs
)
return
self
.
route_list
(
**
kwargs
)
def
get_values
(
self
,
row
,
istime
=
False
):
def
get_values
(
self
,
row
,
istime
=
False
,
null
=
False
):
d
=
row
.
to_dict
()
d
=
row
.
to_dict
(
null
=
null
)
# if 'tanggal' in d and d['tanggal']:
# if 'tanggal' in d and d['tanggal']:
# d["tanggal"] = dmy(row.tanggal)
# d["tanggal"] = dmy(row.tanggal)
for
f
in
d
:
for
f
in
d
:
...
...
opensipkd/models/base.py
View file @
f7e42dc
...
@@ -45,7 +45,7 @@ class CommonModel(object):
...
@@ -45,7 +45,7 @@ class CommonModel(object):
for
column
in
self
.
__table__
.
columns
:
for
column
in
self
.
__table__
.
columns
:
value
=
getattr
(
self
,
column
.
name
)
value
=
getattr
(
self
,
column
.
name
)
if
value
or
null
:
if
value
or
null
:
if
type
(
column
.
type
)
==
DateTime
and
date_format
:
if
type
(
column
.
type
)
is
DateTime
and
date_format
:
if
value
:
if
value
:
values
[
column
.
name
]
=
value
.
strftime
(
date_format
)
values
[
column
.
name
]
=
value
.
strftime
(
date_format
)
else
:
else
:
...
...
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