misc: add support for sharing custom 404 page (#29837)
This commit is contained in:
parent
f42fdf1b0d
commit
a9f08bef7d
|
@ -46,7 +46,7 @@ class RemoteTemplate(object):
|
|||
|
||||
def get_cached_item(self):
|
||||
item = cache.get(self.PAGE_CACHE_KEY)
|
||||
if item:
|
||||
if self.source != '404' and item:
|
||||
# page_cache is a dict redirect_url -> page content, get the best
|
||||
# match.
|
||||
page_cache, expiry_time = item
|
||||
|
@ -128,18 +128,22 @@ class RemoteTemplate(object):
|
|||
|
||||
|
||||
def theme_base(request):
|
||||
# this context processor adds two variables to context:
|
||||
# this context processor adds three variables to context:
|
||||
#
|
||||
# * theme_base will get evaluated when encountered in a template and return
|
||||
# a template string downloaded from settings.THEME_SKELETON_URL.
|
||||
#
|
||||
# It is to be used by "slave" sites, authentic, w.c.s., etc.
|
||||
# * theme_404 is identical but dedicated to 404 erorr pages.
|
||||
#
|
||||
# Both those variables are to be used by "slave" sites, authentic,
|
||||
# w.c.s., etc.
|
||||
#
|
||||
# * theme_base_filename will return the filename to be used as base
|
||||
# template by combo, it will be taken from template_vars and will
|
||||
# default to theme.html.
|
||||
source = request.build_absolute_uri()
|
||||
return {'theme_base': RemoteTemplate(source).get_template,
|
||||
'theme_404': RemoteTemplate('404').get_template,
|
||||
'theme_base_filename': template_vars(request).get('theme_base_filename') or 'theme.html'
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue