change hpc_config and legacyapi into new-style api views
Change-Id: I24070e08102c898dae676bf6b12c41e8d4eb3134
diff --git a/xos/api/service/hpc/legacyapi.py b/xos/api/service/hpc/legacyapi.py
index b5592c0..c3efa8f 100644
--- a/xos/api/service/hpc/legacyapi.py
+++ b/xos/api/service/hpc/legacyapi.py
@@ -10,6 +10,7 @@
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
+from rest_framework.views import APIView
def ps_id_to_pl_id(x):
# Since we don't want the XOS object IDs to conflict with existing
@@ -327,9 +328,12 @@
"GetNodes2": HandleGetNodes2,
"GetSlices2": HandleGetSlices2}
-@csrf_exempt
-def LegacyXMLRPC(request):
- if request.method == "POST":
+#@csrf_exempt
+class LegacyApi(APIView):
+ method_kind = "list"
+ method_name = "legacyapi"
+
+ def post(self, request, format=None):
try:
(args, method) = xmlrpclib.loads(request.body)
result = None
@@ -339,8 +343,6 @@
except:
traceback.print_exc()
return HttpResponseServerError()
- else:
- return HttpResponse("Not Implemented")
if __name__ == '__main__':
slices = GetSlices(slice_remap = DEFAULT_REMAP)