Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-tools
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 50e738b7
authored
Mar 02, 2024
by
aagusti
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
getlogo
1 parent
f2879ddd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
opensipkd/tools/__init__.py
opensipkd/tools/report.py
setup.py
opensipkd/tools/__init__.py
View file @
50e738b
...
...
@@ -25,6 +25,14 @@ log = logging.getLogger(__name__)
################
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'
):
"""
...
...
opensipkd/tools/report.py
View file @
50e738b
...
...
@@ -18,6 +18,9 @@ log = logging.getLogger(__name__)
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'
))
return
path
+
"/logo.png"
,
path
+
"/line.png"
...
...
@@ -167,11 +170,12 @@ def odt_export_(filename, file_type, password=None):
out_file
=
'.'
.
join
([
filename
,
file_type
])
if
not
os
.
path
.
isfile
(
odt_file
):
log
.
info
(
"ODT FILE NOTFOUND"
)
log
.
error
(
"ODT FILE NOTFOUND"
)
return
dict
(
error
=
dict
(
code
=-
1
,
message
=
'File
%
s tidak ditemukan '
%
odt_file
))
else
:
if
not
os
.
path
.
isfile
(
out_file
):
log
.
error
(
"PDF FILE NOTFOUND"
)
return
dict
(
error
=
dict
(
code
=-
1
,
message
=
'File
%
s tidak ditemukan '
%
out_file
))
os
.
remove
(
odt_file
)
...
...
setup.py
View file @
50e738b
...
...
@@ -25,9 +25,12 @@ requires = [
"idna"
,
"pytz"
,
"requests"
,
"pyreportjasper"
"pyreportjasper"
,
#"z3c.rml",
# "pikepdf",
"qrcode"
,
"papyrus"
,
"fdf"
]
dev_requires
=
[
...
...
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