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 95f22e7e
authored
Mar 17, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
perbaikan remove htmltag
1 parent
6e9e2876
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
opensipkd/base/views/base_views.py
opensipkd/base/views/base_views.py
View file @
95f22e7
...
...
@@ -12,7 +12,7 @@ from deform import (widget, Form, ValidationFailure, FileData, )
from
deform.widget
import
SelectWidget
from
pyramid.httpexceptions
import
HTTPFound
,
HTTPNotFound
from
pyramid.request
import
Response
from
sqlalchemy
import
Table
from
sqlalchemy
import
Table
,
values
# from opensipkd.base.views.upload import tmpstore
from
opensipkd.tools.captcha
import
img_captcha
...
...
@@ -304,6 +304,17 @@ class BaseView(object):
def
form_validator
(
self
,
form
,
value
):
"""Digunakan untuk memvalidasi form sebelum disubmit"""
exc
=
colander
.
Invalid
(
form
,
"Form tidak valid"
)
for
k
,
v
in
value
.
items
():
if
v
and
self
.
html_tag_cleaner
and
isinstance
(
v
,
str
)
and
v
!=
""
:
try
:
value
[
k
]
=
lxml
.
html
.
fromstring
(
v
)
.
text_content
()
except
Exception
as
e
:
msg
=
f
"Error cleaning HTML for key {k}: {e}"
log
.
error
(
msg
)
exc
[
k
]
=
msg
raise
exc
from
e
"""
def form_validate(self, form, err_value, **kwargs):
...
...
@@ -998,14 +1009,10 @@ class BaseView(object):
if
k
not
in
values
:
if
v
:
values
[
k
]
=
v
for
k
,
v
in
values
.
items
():
if
v
and
self
.
html_tag_cleaner
and
isinstance
(
v
,
str
)
and
v
!=
""
:
values
[
k
]
=
lxml
.
html
.
fromstring
(
v
)
.
text_content
()
log
.
debug
(
f
"Base save_request: {values}"
)
return
self
.
save
(
values
,
self
.
req
.
user
,
row
)
def
id_not_found
(
self
,
**
kwargs
):
msg
=
f
"Data yang dicari Tidak Ditemukan ID:"
\
f
" {self.req.matchdict['id']}."
...
...
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