Skip to content

Commit

Permalink
chore: [Deprecation] Use Markup instead of HTMLString (#1729)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Polegoshko <andrey@polegoshko.by>
Co-authored-by: Daniel Vaz Gaspar <danielvazgaspar@gmail.com>
  • Loading branch information
3 people authored Nov 15, 2021
1 parent 0747f7d commit 071e66b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
11 changes: 6 additions & 5 deletions flask_appbuilder/fieldwidgets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from flask_babel import lazy_gettext as _
from markupsafe import Markup
from wtforms import widgets
from wtforms.widgets import html_params, HTMLString
from wtforms.widgets import html_params


class DatePickerWidget(object):
Expand All @@ -24,7 +25,7 @@ def __call__(self, field, **kwargs):
field.data = ""
template = self.data_template

return HTMLString(
return Markup(
template % {"text": html_params(type="text", value=field.data, **kwargs)}
)

Expand All @@ -50,7 +51,7 @@ def __call__(self, field, **kwargs):
field.data = ""
template = self.data_template

return HTMLString(
return Markup(
template % {"text": html_params(type="text", value=field.data, **kwargs)}
)

Expand Down Expand Up @@ -103,7 +104,7 @@ def __call__(self, field, **kwargs):
field.data = ""
template = self.data_template

return HTMLString(
return Markup(
template % {"text": html_params(type="text", value=field.data, **kwargs)}
)

Expand Down Expand Up @@ -132,7 +133,7 @@ def __call__(self, field, **kwargs):
field.data = ""
template = self.data_template

return HTMLString(
return Markup(
template % {"text": html_params(type="text", value=field.data, **kwargs)}
)

Expand Down
7 changes: 4 additions & 3 deletions flask_appbuilder/upload.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from flask_babel import gettext
from markupsafe import Markup
from werkzeug.datastructures import FileStorage
from wtforms import fields, ValidationError
from wtforms.widgets import html_params, HTMLString
from wtforms.widgets import html_params

from .filemanager import FileManager, ImageManager

Expand Down Expand Up @@ -45,7 +46,7 @@ def __call__(self, field, **kwargs):

template = self.data_template if field.data else self.empty_template

return HTMLString(
return Markup(
template
% {
"text": html_params(type="text", value=field.data),
Expand Down Expand Up @@ -94,7 +95,7 @@ def __call__(self, field, **kwargs):
else:
template = self.empty_template

return HTMLString(template % args)
return Markup(template % args)

def get_url(self, field):
im = ImageManager()
Expand Down
2 changes: 1 addition & 1 deletion requirements-extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ cython==0.29.17
mysqlclient==2.0.1
psycopg2-binary==2.8.6
pyodbc==4.0.30
requests==2.25.0
requests==2.26.0
Authlib==0.15.4
python-ldap==3.3.1

0 comments on commit 071e66b

Please sign in to comment.