From dd52ccab2aa41f8410da18ee0b26d99e3adb87a3 Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 12 Jun 2014 13:03:46 +0100 Subject: [PATCH] Remove X-Requested-With header hacks on the incoming requests to preview_on_edit and preview_on_create - no longer necessary, because we're not passing that request to the preview logic Conflicts: wagtail/wagtailadmin/views/pages.py --- wagtail/wagtailadmin/views/pages.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index fd0c97b02f..7a2ec4f06b 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -409,13 +409,6 @@ def preview_on_edit(request, page_id): if form.is_valid(): form.save(commit=False) - # This view will generally be invoked as an AJAX request; as such, in the case of - # an error Django will return a plaintext response. This isn't what we want, since - # we will be writing the response back to an HTML page regardless of success or - # failure - as such, we strip out the X-Requested-With header to get Django to return - # an HTML error response - request.META.pop('HTTP_X_REQUESTED_WITH', None) - try: display_mode = request.GET['mode'] except KeyError: @@ -465,13 +458,6 @@ def preview_on_create(request, content_type_app_name, content_type_model_name, p page.depth = parent_page.depth + 1 page.path = Page._get_children_path_interval(parent_page.path)[1] - # This view will generally be invoked as an AJAX request; as such, in the case of - # an error Django will return a plaintext response. This isn't what we want, since - # we will be writing the response back to an HTML page regardless of success or - # failure - as such, we strip out the X-Requested-With header to get Django to return - # an HTML error response - request.META.pop('HTTP_X_REQUESTED_WITH', None) - try: display_mode = request.GET['mode'] except KeyError: