示例#1
0
	def get(self, request):
		ajaxMainClass = SubscriberAjaxHandler()
		ajaxMainClass.httpRequest = request
		ajaxMainClass.user = request.user
		funtionToCall = getattr(ajaxMainClass, 'get_approvers', None)
		if not funtionToCall:
			return http.Http404

		responseValues = funtionToCall(**request.GET.dict())
		response = http.HttpResponse()
		response.status_code = 200
		response.write(responseValues)
		response['Content-Type'] = 'application/json'
		return response	
示例#2
0
	def post(self, request):
		args = json.loads(request.body)
		ajaxMainClass = SubscriberAjaxHandler()
		ajaxMainClass.httpRequest = request
		ajaxMainClass.user = request.user
		funtionToCall = getattr(ajaxMainClass, args.pop(), None)
		if not funtionToCall:
			return http.Http404

		responseValues = funtionToCall(*args)
		response = http.HttpResponse()
		response.status_code = 200
		response.write(responseValues)
		response['Content-Type'] = 'application/json'
		return response
示例#3
0
	def get(self, request):
		request_values = {}
		for key, value in request.GET.iteritems():
			request_values.update({key: value})
		ajaxMainClass = SubscriberAjaxHandler()
		ajaxMainClass.httpRequest = request
		ajaxMainClass.user = request.user
		funtionToCall = getattr(ajaxMainClass, request_values.pop('fn'), None)
		if not funtionToCall:
			return http.Http404

		responseValues = funtionToCall(**request_values)
		response = http.HttpResponse()
		response.status_code = 200
		response.write(responseValues)
		response['Content-Type'] = 'application/json'
		return response