Эх сурвалжийг харах

HUE-2510 [pig] Ensure that CSRF cookie is loaded in the editor

If the CSRF cookie is not present, then AJAX calls are not accepted,
which caused Hue to return a 403 statue code.

The fix ensures that the cookie is set when the Pig editor page is loaded.
Luca Natali 11 жил өмнө
parent
commit
fb37853801

+ 2 - 1
apps/pig/src/pig/views.py

@@ -21,6 +21,7 @@ import logging
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse
 from django.utils.translation import ugettext as _
+from django.views.decorators.csrf import ensure_csrf_cookie
 from django.views.decorators.http import require_http_methods
 
 from desktop.lib.django_util import render
@@ -39,7 +40,7 @@ from pig.models import get_workflow_output, hdfs_link, PigScript,\
 
 LOG = logging.getLogger(__name__)
 
-
+@ensure_csrf_cookie
 def app(request):
   return render('app.mako', request, {
     'autocomplete_base_url': reverse('beeswax:api_autocomplete_databases', kwargs={}),