change mimetype to content_type
diff --git a/planetstack/core/dashboard/views/analytics.py b/planetstack/core/dashboard/views/analytics.py
index 09d1bbc..e1794c1 100644
--- a/planetstack/core/dashboard/views/analytics.py
+++ b/planetstack/core/dashboard/views/analytics.py
@@ -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')
diff --git a/planetstack/core/dashboard/views/cdn.py b/planetstack/core/dashboard/views/cdn.py
index 63ec2f2..4fb29cb 100644
--- a/planetstack/core/dashboard/views/cdn.py
+++ b/planetstack/core/dashboard/views/cdn.py
@@ -19,7 +19,7 @@
"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 @@
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')
diff --git a/planetstack/core/dashboard/views/customize.py b/planetstack/core/dashboard/views/customize.py
index f081cfb..212cc4d 100644
--- a/planetstack/core/dashboard/views/customize.py
+++ b/planetstack/core/dashboard/views/customize.py
@@ -18,5 +18,5 @@
udbv = UserDashboardView(user=request.user, dashboardView=dashboard, order=i)
udbv.save()
- return HttpResponse(json.dumps("Success"), mimetype='application/javascript')
+ return HttpResponse(json.dumps("Success"), content_type='application/javascript')
diff --git a/planetstack/core/dashboard/views/interactions.py b/planetstack/core/dashboard/views/interactions.py
index 23d755f..a2f88ff 100644
--- a/planetstack/core/dashboard/views/interactions.py
+++ b/planetstack/core/dashboard/views/interactions.py
@@ -35,7 +35,7 @@
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 = {}
diff --git a/planetstack/core/dashboard/views/tenant.py b/planetstack/core/dashboard/views/tenant.py
index 9066a2b..930ccf6 100644
--- a/planetstack/core/dashboard/views/tenant.py
+++ b/planetstack/core/dashboard/views/tenant.py
@@ -31,7 +31,7 @@
addOrModifyPorts(networkPorts,sliceName)
if privateVolume=="true":
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):
@@ -64,7 +64,7 @@
addOrModifyPorts(networkPorts,sliceName)
if privateVolume=="true":
privateVolForSlice(request.user,sliceName)
- return HttpResponse(json.dumps("Slice updated"), mimetype='application/javascript')
+ return HttpResponse(json.dumps("Slice updated"), content_type='application/javascript')
def addNetwork(name,template,sliceName):
networkTemplate=NetworkTemplate.objects.get(name=template)
@@ -237,7 +237,7 @@
#print slice, slice.id
sliceToDel=Slice(name=sliceName, id=slice.id)
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 @@
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 @@
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 @@
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')
diff --git a/planetstack/core/dashboard/views/test.py b/planetstack/core/dashboard/views/test.py
index 24380c5..4eae215 100644
--- a/planetstack/core/dashboard/views/test.py
+++ b/planetstack/core/dashboard/views/test.py
@@ -2,4 +2,4 @@
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')