Commit edf9616d 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 f8082d99
......@@ -302,7 +302,7 @@ def _get_projects(query, request_user=None):
@commit_on_success_strict()
def create_project(request):
user = request.user
data = request.raw_post_data
data = request.body
app_data = json.loads(data)
return submit_application(app_data, user, project_id=None)
......@@ -340,7 +340,7 @@ def _get_project(project_id, request_user=None):
@commit_on_success_strict()
def modify_project(request, project_id):
user = request.user
data = request.raw_post_data
data = request.body
app_data = json.loads(data)
return submit_application(app_data, user, project_id=project_id)
......@@ -469,7 +469,7 @@ PROJECT_ACTION = {
@commit_on_success_strict()
def project_action(request, project_id):
user = request.user
data = request.raw_post_data
data = request.body
input_data = json.loads(data)
func, action_data = get_action(PROJECT_ACTION, input_data)
......@@ -550,7 +550,7 @@ APPLICATION_ACTION = {
@commit_on_success_strict()
def application_action(request, app_id):
user = request.user
data = request.raw_post_data
data = request.body
input_data = json.loads(data)
func, action_data = get_action(APPLICATION_ACTION, input_data)
......@@ -634,7 +634,7 @@ MEMBERSHIPS_ACTION = {
@commit_on_success_strict()
def post_memberships(request):
user = request.user
data = request.raw_post_data
data = request.body
input_data = json.loads(data)
func, action_data = get_action(MEMBERSHIPS_ACTION, input_data)
return func(action_data, user)
......
......@@ -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:
......@@ -206,7 +206,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:
......@@ -262,7 +262,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:
......
......@@ -82,7 +82,7 @@ def xml_response(content, template, status_code=None):
def read_json_body(request, default=None):
body = request.raw_post_data
body = request.body
if not body and request.method == "GET":
body = request.GET.get("body")
if not body:
......@@ -177,7 +177,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 not 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