Commit 50e738b7 by aagusti

getlogo

1 parent f2879ddd
...@@ -25,6 +25,14 @@ log = logging.getLogger(__name__) ...@@ -25,6 +25,14 @@ log = logging.getLogger(__name__)
################ ################
MSISDN_ALLOW_CHARS = map(lambda x: str(x), range(10)) # + ['+'] MSISDN_ALLOW_CHARS = map(lambda x: str(x), range(10)) # + ['+']
class CSRFSchema(colander.Schema):
def after_bind(self, schema, kwargs):
request = kwargs["request"]
csrf_token = new_csrf_token(request)
self["csrf_token"] = colander.SchemaNode(
colander.String(), widget=widget.TextInputWidget(),
default=csrf_token
)
def get_msisdn(msisdn, country='+62'): def get_msisdn(msisdn, country='+62'):
""" """
......
...@@ -18,6 +18,9 @@ log = logging.getLogger(__name__) ...@@ -18,6 +18,9 @@ log = logging.getLogger(__name__)
def get_logo(base_path=""): def get_logo(base_path=""):
if not base_path:
import opensipkd.base
base_path = os.path.dirname(os.path.abspath(opensipkd.base.__file__))
path = get_params('report_img', os.path.join(base_path, 'static/img')) path = get_params('report_img', os.path.join(base_path, 'static/img'))
return path + "/logo.png", path + "/line.png" return path + "/logo.png", path + "/line.png"
...@@ -167,11 +170,12 @@ def odt_export_(filename, file_type, password=None): ...@@ -167,11 +170,12 @@ def odt_export_(filename, file_type, password=None):
out_file = '.'.join([filename, file_type]) out_file = '.'.join([filename, file_type])
if not os.path.isfile(odt_file): if not os.path.isfile(odt_file):
log.info("ODT FILE NOTFOUND") log.error("ODT FILE NOTFOUND")
return dict(error=dict(code=-1, return dict(error=dict(code=-1,
message='File %s tidak ditemukan ' % odt_file)) message='File %s tidak ditemukan ' % odt_file))
else: else:
if not os.path.isfile(out_file): if not os.path.isfile(out_file):
log.error("PDF FILE NOTFOUND")
return dict(error=dict(code=-1, return dict(error=dict(code=-1,
message='File %s tidak ditemukan ' % out_file)) message='File %s tidak ditemukan ' % out_file))
os.remove(odt_file) os.remove(odt_file)
......
...@@ -25,9 +25,12 @@ requires = [ ...@@ -25,9 +25,12 @@ requires = [
"idna", "idna",
"pytz", "pytz",
"requests", "requests",
"pyreportjasper" "pyreportjasper",
#"z3c.rml", #"z3c.rml",
# "pikepdf", # "pikepdf",
"qrcode",
"papyrus",
"fdf"
] ]
dev_requires = [ dev_requires = [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!