ASKBOT / askbot-devel

Askbot is a Django/Python Q&A forum. **Contributors README**: https://github.com/ASKBOT/askbot-devel#how-to-contribute. Commercial hosting of Askbot and support are available at https://askbot.com
Other
1.56k stars 627 forks source link

Adopt imports to allow usage of newer jinja #917

Closed CarliJoy closed 1 year ago

CarliJoy commented 1 year ago

Askbot fails because of a AttributeError: module 'jinja2' has no attribute 'Markup' error. It seems that this has been removed from the very recent new Jinja version : https://jinja.palletsprojects.com/en/3.1.x/changes/?highlight=markup#version-3-1-0

If would be good if the imports would be adopted to use MarkupSafe instead of jinja for Markup. Example Stacktrace

askdoc_1  |   File "/usr/local/lib/python3.9/site-packages/askbot/templatetags/extra_filters_jinja.py", line 448, in escapejs
askdoc_1  |     return jinja2.Markup("".join(_js_escapes.get(l, l) for l in value))
askdoc_1  | AttributeError: module 'jinja2' has no attribute 'Markup'
askdoc_1  | 
evgenyfadeev commented 1 year ago

Try latest v2 Jinja, I'll limit the version from above today, then see what to do with Jinja V3

CarliJoy commented 1 year ago

The version pre 3.1.0 works as expected. Jinja is not following SemVer btw.

The linked patch should fix it as expected. markupsafe is a depedency of jinja for long. I justed added in the dependencies in order to be explicit.