viur-framework/viur-core

viur-core's `@jinjaGlobalFilter` `urlencode` shadows Jinja's `urlencode` filter

Closed this issue · 1 comments

@jinjaGlobalFilter
def urlencode(render: Render, val: str) -> str:
"""
Jinja2 filter: Make a string URL-safe.
:param render: The html-renderer instance.
:param val: String to be quoted.
:returns: Quoted string.
"""
# quote_plus fails if val is None
if not val:
return ""
if isinstance(val, str):
val = val.encode("UTF-8")
return urllib.parse.quote_plus(val)

https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.urlencode

IMO we could completely remove the smaller viur-core implementation.

Fixed by #1271