Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

User 'content_type' parameter instead of mimetype, this is deprecated

Roland Geider97f359afbb6e
diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.py
index febbe3725..f909e1f42 100644
--- a/wger/exercises/views/exercises.py
+++ b/wger/exercises/views/exercises.py
@@ -350,6 +350,5 @@ def search(request):
results.append(exercise_json)
data = json.dumps(results)
- # Return the results to the server
- mimetype = 'application/json'
- return HttpResponse(data, mimetype)
+ # Return the results to the client
+ return HttpResponse(data, content_type='application/json')
diff --git a/wger/manager/pdf.py b/wger/manager/pdf.py
index 2917c20bf..af5f54692 100644
--- a/wger/manager/pdf.py
+++ b/wger/manager/pdf.py
@@ -46,7 +46,7 @@ def workout_log(request, id):
'''
# Create the HttpResponse object with the appropriate PDF headers.
- response = HttpResponse(mimetype='application/pdf')
+ response = HttpResponse(content_type='application/pdf')
#Load the workout
workout = get_object_or_404(Workout, pk=id, user=request.user)
diff --git a/wger/manager/views/ical.py b/wger/manager/views/ical.py
index 483c1a351..faa4d39c3 100644
--- a/wger/manager/views/ical.py
+++ b/wger/manager/views/ical.py
@@ -118,7 +118,7 @@ def export(request, pk):
get_events_workout(calendar, workout, request.user.userprofile.workout_duration)
# Send the file to the user
- response = HttpResponse(mimetype='text/calendar')
+ response = HttpResponse(content_type='text/calendar')
response['Content-Disposition'] = \
'attachment; filename=Calendar-workout-{0}.ics'.format(workout.pk)
response.write(calendar.to_ical())
@@ -145,7 +145,7 @@ def export_schedule(request, pk):
start_date = start_date + datetime.timedelta(weeks=step.duration)
# Send the file to the user
- response = HttpResponse(mimetype='text/calendar')
+ response = HttpResponse(content_type='text/calendar')
response['Content-Disposition'] = \
'attachment; filename=Calendar-schedule-{0}.ics'.format(schedule.pk)
response.write(calendar.to_ical())
diff --git a/wger/nutrition/views/ingredient.py b/wger/nutrition/views/ingredient.py
index 3c59ea053..fb0d3c3c4 100644
--- a/wger/nutrition/views/ingredient.py
+++ b/wger/nutrition/views/ingredient.py
@@ -235,8 +235,7 @@ def search(request):
data = json.dumps(results)
# Return the results to the server
- mimetype = 'application/json'
- return HttpResponse(data, mimetype)
+ return HttpResponse(data, content_type='application/json')
# Usual search (perhaps JS disabled), present the results as normal HTML page
else:
diff --git a/wger/nutrition/views/plan.py b/wger/nutrition/views/plan.py
index 5ed0900a0..3807dd9ca 100644
--- a/wger/nutrition/views/plan.py
+++ b/wger/nutrition/views/plan.py
@@ -169,7 +169,7 @@ def export_pdf(request, id):
plan_data = plan.get_nutritional_values()
# Create the HttpResponse object with the appropriate PDF headers.
- response = HttpResponse(mimetype='application/pdf')
+ response = HttpResponse(content_type='application/pdf')
# Create the PDF object, using the response object as its "file."
doc = SimpleDocTemplate(response,
diff --git a/wger/weight/views.py b/wger/weight/views.py
index 2e19aefb3..98845c754 100644
--- a/wger/weight/views.py
+++ b/wger/weight/views.py
@@ -118,7 +118,7 @@ def export_csv(request):
'''
# Prepare the response headers
- response = HttpResponse(mimetype='text/csv')
+ response = HttpResponse(content_type='text/csv')
# Convert all weight data to CSV
writer = csv.writer(response)
@@ -189,8 +189,7 @@ def get_weight_data(request):
'id': i.id})
# Return the results to the server
- mimetype = 'application/json'
- return HttpResponse(json.dumps(chart_data), mimetype)
+ return HttpResponse(json.dumps(chart_data), content_type='application/json')
CSV_DATE_FORMAT = (('%d.%m.%Y', 'DD.MM.YYYY (30.01.2012)'),