Does Flask's url_for
method have an option to disable autoescaping? So if I have an endpoint called getUser
with a route like this: /user/<userID>
, I want to call url_for('getUser', userID='%')
and have it return /user/%
. Currently it will escape the % symobl and give out /user/%25
. I want to do that because url_for
has to run at template compile-time, but the final URL is composed when a javscript script runs. I will be using a javascript string substitution method to convert /user/%
into /user/abcd
, but the substitution script I'm using requires you to use a %
symbol as the placeholder.
相关问题
- Backbone.js PushState routes .htaccess only workin
- Plain (non-HTML) error pages in REST api
- WTForms form with custom validate method is never
- flask application with watchdog observer
- Laravel - Implicit route model binding with soft d
相关文章
- 请问为什么后台获取不到表单数据
- TypeError: 'BaseQuery' object is not calla
- EscapeDataString having differing behaviour betwee
- How do I send cookies with request when testing Fl
- C# HttpClient.SendAsync always returns 404 but URL
- Command line escaping single quote for PowerShell
- Prevent $anchorScroll from modifying the url
- Angular route not working when used with Google Ap
url_for
does not support your use case, but assuming you are using it inside a Jinja template you could just add a call toreplace
to remove the encoding:Alternatively, if you passing the URL around in normal Python code you could use
urllib.parse.unquote
(orurllib.unquote
if you are still on Python 2):