misc: use RequestContext when rendering for search index (#15449)

This commit is contained in:
Frédéric Péters 2017-03-16 08:49:30 +01:00
parent 3e4eef551a
commit 559bf4b0c1
1 changed files with 3 additions and 2 deletions

View File

@ -39,7 +39,8 @@ from django.utils.safestring import mark_safe
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from django.forms.widgets import MediaDefiningClass
from django.template import Context, Template
from django.template import Context, RequestContext, Template
from django.test.client import RequestFactory
from ckeditor.fields import RichTextField
import cmsplugin_blurp.utils
@ -469,7 +470,6 @@ class CellBase(models.Model):
return context
def render_for_search(self):
context = Context({'synchronous': True})
if not self.is_enabled():
return ''
if self.user_dependant:
@ -478,6 +478,7 @@ class CellBase(models.Model):
return ''
if not self.is_visible(user=None):
return ''
context = RequestContext(RequestFactory().get(self.page.get_online_url()), {'synchronous': True})
if not self.is_relevant(context):
return ''
from HTMLParser import HTMLParser