perf: Remove Jinja from import tree

This commit is contained in:
Aditya Hase 2021-02-20 21:18:01 +05:30
parent bbac844de7
commit a708ba4b94
No known key found for this signature in database
GPG key ID: 0A55F0FCA0234972

View file

@ -17,7 +17,6 @@ from frappe.utils import cstr
import frappe, os, re, io, codecs, json
from frappe.model.utils import render_include, InvalidIncludePath
from frappe.utils import strip, strip_html_tags, is_html
from jinja2 import TemplateError
import itertools, operator
def guess_language(lang_list=None):
@ -526,6 +525,8 @@ def extract_messages_from_code(code):
:param code: code from which translatable files are to be extracted
:param is_py: include messages in triple quotes e.g. `_('''message''')`
"""
from jinja2 import TemplateError
try:
code = frappe.as_unicode(render_include(code))
except (TemplateError, ImportError, InvalidIncludePath, IOError):