I'm migrated my code from webapp2 to Flask. (I deploy my code in Google App Engine)
However, I can no longer use this string: "Error: Max %1d characters"
Initialization
flask_app = Flask(__name__)
babel = Babel(flask_app, default_domain='strings')
Html template
<div class="..."></div>
I know that this is not the best use, but I need to keep %1$d as placeholder. (It was working with webapp2)
Log:
...
File ".../libs/flask/templating.py", line 135, in render_template
context, ctx.app)
File ".../libs/flask/templating.py", line 117, in _render
rv = template.render(context)
File ".../libs/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File ".../libs/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File ".../app/templates/filename.html", line 567, in top-level template code
<div class="invalid-feedback"></div>
ValueError: unsupported format character '$' (0x24) at index 29
I've already tried to use the "| e" or "| safe" after " _('error_long_value')" in the HTML template, removing the replace().
from Flask, Jinja2, Babel error on "$" character
No comments:
Post a Comment