def upload(request): user_file = UserFile(user_file=request.FILES["file"]) user_file.save() content = _getMultipartData(user_file.user_file.path, 0, append_new_line=True) ss_response = _send_request('POST', '/REST.svc/v3/file', { "Accept": "application/json", "Content-Type": _getMultipartContentType(), }, body=content, user=request.user) headers = ss_response.getheaders() response = ss_response.read() ss_id = json.loads(response) ## This is the old File::Parser bit parser_response = _send_request('GET', '/REST.svc/v3/file/%s/parser' % ss_id, { "Accept": "application/json", }, user=request.user) parser_data = parser_response.read() json_values = json.loads(parser_data) json_values["sol_id"] = user_file.id json_values["ss_id"] = ss_id json_response = json.dumps(json_values) return HttpResponse(json_response)
def upload(request): user_file = UserFile(user_file=request.FILES["file"]) user_file.save() content = _getMultipartData(user_file.user_file.path, 0, append_new_line=True) # Javerage is just here until we get off yui - the cookies for auth # aren't reliable behind the flash uploader ss_response = _send_request('POST', '/REST.svc/v3/file', { "Accept": "application/json", "Content-Type": _getMultipartContentType(), }, body=content, user="******") headers = ss_response.getheaders() response = ss_response.read() ss_id = json.loads(response) json_response = json.dumps({ "sol_id": user_file.id, "ss_id": ss_id }) return HttpResponse(json_response)