mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-19 15:04:23 +01:00
* Disable jinja cache properly by setting cache_size to 0 (#662) * Without disabling the cache you get some difficult to debug rendering errors. Regression from 1.2.0.
This commit is contained in:
@@ -28,7 +28,6 @@ class CTFdFlask(Flask):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Overriden Jinja constructor setting a custom jinja_environment"""
|
"""Overriden Jinja constructor setting a custom jinja_environment"""
|
||||||
self.jinja_environment = SandboxedBaseEnvironment
|
self.jinja_environment = SandboxedBaseEnvironment
|
||||||
self.jinja_environment.cache = None
|
|
||||||
self.session_interface = CachingSessionInterface(key_prefix='session')
|
self.session_interface = CachingSessionInterface(key_prefix='session')
|
||||||
Flask.__init__(self, *args, **kwargs)
|
Flask.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
@@ -42,7 +41,9 @@ class SandboxedBaseEnvironment(SandboxedEnvironment):
|
|||||||
def __init__(self, app, **options):
|
def __init__(self, app, **options):
|
||||||
if 'loader' not in options:
|
if 'loader' not in options:
|
||||||
options['loader'] = app.create_global_jinja_loader()
|
options['loader'] = app.create_global_jinja_loader()
|
||||||
SandboxedEnvironment.__init__(self, **options)
|
# Disable cache entirely so that themes can be switched (#662)
|
||||||
|
# If the cache is enabled, switching themes will cause odd rendering errors
|
||||||
|
SandboxedEnvironment.__init__(self, cache_size=0, **options)
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user