Commit 94b743e6 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

wheezy: Rename depricated HttpRequest attribute

From django docs:
"""
HttpRequest.raw_post_data renamed to HttpRequest.body

This attribute was confusingly named HttpRequest.raw_post_data, but it
actually provided the body of the HTTP request. It’s been renamed to
HttpRequest.body, and HttpRequest.raw_post_data has been deprecated.
"""
parent 1bea338c
......@@ -116,7 +116,7 @@ def _provisions_to_list(provisions):
@api.api_method(http_method='POST', token_required=True, user_required=False)
@component_from_token
def issue_commission(request):
data = request.raw_post_data
data = request.body
try:
input_data = json.loads(data)
except json.JSONDecodeError:
......@@ -207,7 +207,7 @@ def conflictingCF(serial):
@component_from_token
@commit_on_success_strict()
def resolve_pending_commissions(request):
data = request.raw_post_data
data = request.body
try:
input_data = json.loads(data)
except json.JSONDecodeError:
......@@ -263,7 +263,7 @@ def get_commission(request, serial):
@component_from_token
@commit_on_success_strict()
def serial_action(request, serial):
data = request.raw_post_data
data = request.body
try:
input_data = json.loads(data)
except json.JSONDecodeError:
......
......@@ -165,7 +165,7 @@ def get_uuid_displayname_catalogs(request, user_call=True):
# Error Response Codes: BadRequest (400)
try:
input_data = json.loads(request.raw_post_data)
input_data = json.loads(request.body)
except:
raise faults.BadRequest('Request body should be json formatted.')
else:
......
......@@ -153,7 +153,7 @@ def add_image(request):
with image_backend(request.user_uniq) as backend:
image = backend.register(name, location, params)
else:
#f = StringIO(request.raw_post_data)
#f = StringIO(request.body)
#image = backend.put(name, f, params)
return HttpResponse(status=501) # Not Implemented
......@@ -384,7 +384,7 @@ def update_image_members(request, image_id):
log.debug('update_image_members %s', image_id)
members = []
try:
data = json.loads(request.raw_post_data)
data = json.loads(request.body)
for member in data['memberships']:
members.append(member['member_id'])
except (ValueError, KeyError, TypeError):
......
......@@ -91,7 +91,7 @@ class View(object):
self.request = request
self.args = args
self.kwargs = kwargs
data = request.raw_post_data
data = request.body
if request.method.upper() in ['POST', 'PUT']:
# Expect json data
......
......@@ -81,7 +81,7 @@ def proxy(request, proxy_base=None, target_base=None):
headers.pop(k, None)
kwargs['headers'] = headers
kwargs['body'] = request.raw_post_data
kwargs['body'] = request.body
path = request.path.lstrip('/')
if path.startswith(proxy_base):
......
......@@ -94,7 +94,7 @@ def get_request_dict(request):
Only JSON format is supported
"""
data = request.raw_post_data
data = request.body
content_type = request.META.get("CONTENT_TYPE")
if content_type is None:
raise faults.BadRequest("Missing Content-Type header field")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment