瀏覽代碼

HUE-2436 [oozie] Django-1.6: Change massaged_oozie_jobs_for_json to return dict

Django-1.6 now raises an exception if you create a json response
and the `safe=True` flag is not set. This is because on some older
browsers it's possible to replace the JavaScript Array constructor
to do bad things:

http://django.readthedocs.org/en/latest/ref/request-response.html#serializing-non-dictionary-objects

One odd thing to note is we don't appear to be using:

list_oozie_coordinators?format=json
list_oozie_bundles?format=json

so we could probably delete this from the functions.
Erick Tryzelaar 11 年之前
父節點
當前提交
f7802b7f34

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_sla.mako

@@ -237,7 +237,7 @@ ${ layout.menubar(section='sla', dashboard=True) }
 
     $.getJSON("${url('oozie:list_oozie_workflows')}?format=json&justsla=true", function (data) {
       var _autocomplete = [];
-      $(data).each(function (iWf, item) {
+      $(data.jobs).each(function (iWf, item) {
         _autocomplete.push(item.id);
       });
       $("input[name='job_name']").typeahead({

+ 1 - 1
apps/oozie/src/oozie/views/dashboard.py

@@ -860,7 +860,7 @@ def massaged_oozie_jobs_for_json(oozie_jobs, user, just_sla=False):
       }
       jobs.append(massaged_job)
 
-  return jobs
+  return { 'jobs': jobs }
 
 
 def check_job_access_permission(request, job_id):