Commit f7e42dc6 by aagusti

Perbaikan exception saat upload

1 parent a975ba98
import logging
import os
import re
import traceback
from datetime import datetime
from email.utils import parseaddr
......@@ -353,7 +354,13 @@ class BaseView(object):
break
output_file.write(data)
output_file.close()
self.save_upload(fullpath, delimiter=delimiter)
try:
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:
self.cancel_act()
......@@ -580,8 +587,8 @@ class BaseView(object):
self.req.session.flash(msg, 'error')
return self.route_list(**kwargs)
def get_values(self, row, istime=False):
d = row.to_dict()
def get_values(self, row, istime=False, null=False):
d = row.to_dict(null=null)
# if 'tanggal' in d and d['tanggal']:
# d["tanggal"] = dmy(row.tanggal)
for f in d:
......
......@@ -45,7 +45,7 @@ class CommonModel(object):
for column in self.__table__.columns:
value = getattr(self, column.name)
if value or null:
if type(column.type) == DateTime and date_format:
if type(column.type) is DateTime and date_format:
if value:
values[column.name] = value.strftime(date_format)
else:
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!