Don't fail if jinja2 isn't present and JINJA2_GET_ENVIRONMENT() is called
This can happen when evaluating settings in the default 500 page for instance.
This commit is contained in:
@@ -70,8 +70,11 @@ class CompressorConf(AppConf):
|
|||||||
TEMPLATE_FILTER_CONTEXT = {}
|
TEMPLATE_FILTER_CONTEXT = {}
|
||||||
# Function that returns the Jinja2 environment to use in offline compression.
|
# Function that returns the Jinja2 environment to use in offline compression.
|
||||||
def JINJA2_GET_ENVIRONMENT():
|
def JINJA2_GET_ENVIRONMENT():
|
||||||
|
try:
|
||||||
import jinja2
|
import jinja2
|
||||||
return jinja2.Environment()
|
return jinja2.Environment()
|
||||||
|
except ImportError:
|
||||||
|
return None
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
prefix = 'compress'
|
prefix = 'compress'
|
||||||
|
|||||||
Reference in New Issue
Block a user