Skip to content

Commit 2ed5c19

Browse files
committed
Stop using the request to store the rendered result of application contents
1 parent 5a69235 commit 2ed5c19

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

feincms/content/application/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ def __init__(self, *args, **kwargs):
263263
super(ApplicationContent, self).__init__(*args, **kwargs)
264264
self.app_config = self.ALL_APPS_CONFIG.get(self.urlconf_path, {}).get('config', {})
265265

266-
def render(self, request, **kwargs):
267-
return getattr(request, "_feincms_applicationcontents", {}).get(self.id, u'')
268-
269266
def process(self, request):
270267
page_url = self.parent.get_absolute_url()
271268

@@ -318,15 +315,18 @@ def process(self, request):
318315
if isinstance(output, HttpResponse):
319316
if output.status_code == 200:
320317
if not getattr(output, 'standalone', False):
321-
request._feincms_applicationcontents[self.id] = mark_safe(output.content.decode('utf-8'))
318+
self.rendered_result = mark_safe(output.content.decode('utf-8'))
322319
# Copy relevant headers for later perusal
323320
for h in ( 'Cache-Control', 'Last-Modified', 'Expires'):
324321
if h in output:
325322
request._feincms_applicationcontents_headers[h].append(output[h])
326323

327324
return output
328325
else:
329-
request._feincms_applicationcontents[self.id] = mark_safe(output)
326+
self.rendered_result = mark_safe(output)
327+
328+
def render(self, request, **kwargs):
329+
return self.rendered_result
330330

331331
def save(self, *args, **kwargs):
332332
super(ApplicationContent, self).save(*args, **kwargs)

feincms/views/applicationcontent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def __call__(self, request, path=None):
2626

2727
def prepare(self, request, page):
2828
# prepare storage for rendered application contents
29-
if not hasattr(request, '_feincms_applicationcontents'):
30-
request._feincms_applicationcontents = {}
29+
if not hasattr(request, '_feincms_applicationcontents_headers'):
3130
request._feincms_applicationcontents_headers = defaultdict(list)
3231

3332
# Used to provide additional app-specific context variables:

0 commit comments

Comments
 (0)