common (template): suppress jinja2 depreaction warning (to be removed once 2.10.1 is released)
This commit is contained in:
parent
b8e9212b8d
commit
e87c07b200
1 changed files with 10 additions and 3 deletions
|
|
@ -37,6 +37,8 @@ import pygments
|
|||
from pygments import lexers
|
||||
from pygments import formatters
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
try:
|
||||
import sat_templates
|
||||
except ImportError:
|
||||
|
|
@ -48,7 +50,14 @@ else:
|
|||
sat_templates # to avoid pyflakes warning
|
||||
|
||||
try:
|
||||
import jinja2
|
||||
import warnings
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
import jinja2
|
||||
jinja2_version = tuple([int(n) for n in jinja2.__version__.split('.')])
|
||||
if jinja2_version > (2, 10, 1):
|
||||
log.warning("New jinja2 version available, warnings catches can be removed")
|
||||
except:
|
||||
raise exceptions.MissingModule(
|
||||
"Missing module jinja2, please install it from http://jinja.pocoo.org or with "
|
||||
|
|
@ -63,8 +72,6 @@ from jinja2 import contextfilter
|
|||
from jinja2.loaders import split_template_path
|
||||
from lxml import etree
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
HTML_EXT = ("html", "xhtml")
|
||||
RE_ATTR_ESCAPE = re.compile(r"[^a-z_-]")
|
||||
SITE_RESERVED_NAMES = ("sat",)
|
||||
|
|
|
|||
Loading…
Reference in a new issue