Пример #1
0
 def delete(self, request, name):
     try:
         # ensure that an app with this name doesn't already exist
         app = CloudApp.objects.get(user = request.user, name= name)
     except CloudApp.DoesNotExist:
         return Response({"error": "App does not exist"},
                         status=status.HTTP_401_UNAUTHORIZED
                         )
     # delete all app data
     manager = ClassesManager()
     db = request.user.username
     manager.delete_app_data(db, app)
     # delete files
     delete_app_files(app)
     #delete app object
     app.delete()
     return Response({"result": "App deleted successfully"})
Пример #2
0
import logging
import json
from rest_framework.response import Response
from rest_framework import status
from cloudengine.classes.manager import ClassesManager
from cloudengine.core.cloudapi_view import CloudAPIView

logger = logging.getLogger("cloudengine")

manager = ClassesManager()


class AppClassesView(CloudAPIView):
    
    def get(self, request):
        app = request.META.get('app',"")
        if not app:
            return Response({'detail': 'App id not provided'}, 
                                    status=401)
        app_classes = manager.get_classes(app.name)
        return Response({"result": app_classes})


class ClassView(CloudAPIView):

    DEFAULT_QUERY = '{}'

    def get(self, request, cls):
        app = request.META.get('app', None)
        if not app: