change mimetype to content_type
Scott Baker [Mon, 16 Jun 2014 17:25:39 +0000 (10:25 -0700)]
planetstack/core/dashboard/views/analytics.py
planetstack/core/dashboard/views/cdn.py
planetstack/core/dashboard/views/customize.py
planetstack/core/dashboard/views/interactions.py
planetstack/core/dashboard/views/tenant.py
planetstack/core/dashboard/views/test.py

index 09d1bbc..e1794c1 100644 (file)
@@ -1,9 +1,10 @@
 from view_common import *
+import random
 
 class DashboardAnalyticsAjaxView(View):
     def get(self, request, name="hello_world", **kwargs):
         if (name == "bigquery"):
             (mimetype, data) = DoPlanetStackAnalytics(request)
-            return HttpResponse(data, mimetype=mimetype)
+            return HttpResponse(data, content_type=mimetype)
         else:
-            return HttpResponse(json.dumps("Unknown"), mimetype='application/javascript')
+            return HttpResponse(json.dumps("Unknown"), content_type='application/javascript')
index 63ec2f2..4fb29cb 100644 (file)
@@ -19,7 +19,7 @@ class DashboardSummaryAjaxView(View):
                 "total_bandwidth": total_bandwidth,
                 "average_cpu": average_cpu}
 
-        return HttpResponse(json.dumps(result), mimetype='application/javascript')
+        return HttpResponse(json.dumps(result), content_type='application/javascript')
 
 class DashboardAddOrRemoveSliverView(View):
     # TODO: deprecate this view in favor of using TenantAddOrRemoveSliverView
@@ -42,8 +42,8 @@ class DashboardAddOrRemoveSliverView(View):
 
         print '*' * 50
         print 'Ask for site: ' + siteName + ' to ' + actionToDo + ' another HPC Sliver'
-        return HttpResponse(json.dumps("Success"), mimetype='application/javascript')
+        return HttpResponse(json.dumps("Success"), content_type='application/javascript')
 
 class DashboardAjaxView(View):
     def get(self, request, **kwargs):
-        return HttpResponse(json.dumps(getCDNOperatorData(True)), mimetype='application/javascript')
+        return HttpResponse(json.dumps(getCDNOperatorData(True)), content_type='application/javascript')
index f081cfb..212cc4d 100644 (file)
@@ -18,5 +18,5 @@ class DashboardCustomize(View):
             udbv = UserDashboardView(user=request.user, dashboardView=dashboard, order=i)\r
             udbv.save()\r
 \r
-        return HttpResponse(json.dumps("Success"), mimetype='application/javascript')
+        return HttpResponse(json.dumps("Success"), content_type='application/javascript')
 
index 23d755f..a2f88ff 100644 (file)
@@ -35,7 +35,7 @@ class DashboardSliceInteractions(View):
             result["title"] = "Slice interactions by sliver nodes"
             result["objectName"] = "nodes"
 
-        return HttpResponse(json.dumps(result), mimetype='application/javascript')
+        return HttpResponse(json.dumps(result), content_type='application/javascript')
 
     def build_id_list(self, slices, name):
         ids_by_slice = {}
index 9066a2b..930ccf6 100644 (file)
@@ -31,7 +31,7 @@ class TenantCreateSlice(View):
           addOrModifyPorts(networkPorts,sliceName)\r
           if privateVolume=="true":\r
                privateVolForSlice(request.user,sliceName)
-        return HttpResponse(json.dumps("Slice created"), mimetype='application/javascript')
+        return HttpResponse(json.dumps("Slice created"), content_type='application/javascript')
 
 def privateVolForSlice(user,sliceName):
        if not hasPrivateVolume(sliceName):\r
@@ -64,7 +64,7 @@ class TenantUpdateSlice(View):
        addOrModifyPorts(networkPorts,sliceName)\r
        if privateVolume=="true":\r
                 privateVolForSlice(request.user,sliceName)\r
-        return HttpResponse(json.dumps("Slice updated"), mimetype='application/javascript')\r
+        return HttpResponse(json.dumps("Slice updated"), content_type='application/javascript')\r
 \r
 def addNetwork(name,template,sliceName):\r
        networkTemplate=NetworkTemplate.objects.get(name=template)\r
@@ -237,7 +237,7 @@ class TenantDeleteSliceView(View):
                 #print slice, slice.id\r
                 sliceToDel=Slice(name=sliceName, id=slice.id)\r
                 sliceToDel.delete()
-                return HttpResponse(json.dumps("Slice deleted"), mimetype='application/javascript')
+                return HttpResponse(json.dumps("Slice deleted"), content_type='application/javascript')
 
 class TenantAddOrRemoveSliverView(View):
     """ Add or remove slivers from a Slice
@@ -283,7 +283,7 @@ class TenantAddOrRemoveSliverView(View):
         else:
             return HttpResponseServerError("Unknown actionToDo %s" % actionToDo)
 
-        return HttpResponse(json.dumps(sitesChanged), mimetype='application/javascript')
+        return HttpResponse(json.dumps(sitesChanged), content_type='application/javascript')
 
     def get(self, request, *args, **kwargs):
         request.POST = request.GET
@@ -300,7 +300,7 @@ class TenantPickSitesView(View):
         ip = request.GET.get("ip", get_ip(request))
         sites = tenant_pick_sites(request.user, user_ip=ip, count=0, slice=slice)
         sites = [x.name for x in sites]
-        return HttpResponse(json.dumps(sites), mimetype='application/javascript')
+        return HttpResponse(json.dumps(sites), content_type='application/javascript')
 
 def siteSortKey(site, slice=None, count=None, lat=None, lon=None):
     # try to pick a site we're already using
@@ -336,4 +336,4 @@ def tenant_pick_sites(user, user_ip=None, slice=None, count=None):
 
 class TenantViewData(View):
     def get(self, request, **kwargs):
-        return HttpResponse(json.dumps(getTenantSliceInfo(request.user, True)), mimetype='application/javascript')
+        return HttpResponse(json.dumps(getTenantSliceInfo(request.user, True)), content_type='application/javascript')
index 24380c5..4eae215 100644 (file)
@@ -2,4 +2,4 @@ from view_common import *
 
 class DashboardUserSiteView(View):
     def get(self, request, **kwargs):
-        return HttpResponse(json.dumps(getDashboardContext(request.user, tableFormat=True)), mimetype='application/javascript')
+        return HttpResponse(json.dumps(getDashboardContext(request.user, tableFormat=True)), content_type='application/javascript')