Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create your views here.
- from django.http import HttpResponse
- from django.contrib.auth.models import User
- from django.core import serializers
- def index(request, group, function, path):
- try:
- api = API()
- method = getattr(api, group + '_' + function)
- result = method(path)
- except Exception, e:
- return HttpResponse(e)
- return render_api_response(result)
- class API:
- def users_create(request, path):
- pass
- def users_fetch(request, path):
- id = path.replace('/', '')
- return User.objects.get(id = id)
- def render_api_response(data):
- response = serializers.serialize('xml', [data], indent = True)
- return HttpResponse(response, mimetype = 'text/xml')
Add Comment
Please, Sign In to add comment