@csrf_exempt
def blobHandler(request):
    if request.method == 'POST':
        form = DocumentForm(request.POST, request.FILES)
        print('request.POST', request.POST, request.FILES)
        print('validity', form.is_valid())
        if not form.is_valid():
            response = HttpResponse('Invalid form')
            response.status_code = 400
            return response
        else:
            bodyContent = request.POST
            stringifyedContent =dict((str(k), str(v)) for k,v in bodyContent.items())
            stringifyedContent['size'] = request.FILES['blob'].size
            print('size of file', request.FILES['blob'].size)
            createdFile = uploader.models.Blob(
                    content=request.FILES['blob'], **stringifyedContent)

            print('createdFile', createdFile)
            response = HttpResponse()
            try:
                createdFile.save()
                response.status_code = 200
                response.status_message = 'Successful upload'
            except Exception, e:
                print('exception', e)
                response.status_code = httpStatusCodes.INTERNAL_SERVER_ERROR
                response.status_message = 'Exception during uploading'

            return response
    elif request.method is 'PUT':
        # TODO: Match up the query and update keys with those in the API
        response = HttpResponse()
        try:
            queryBody = request.GET
            print('queryBody', queryBody)
            updateBody = request.POST

            if not queryBody:
                response.write(json.dumps(
                    dict(count=0, msg='Specify at least one identifier')
                ))
                response.status_code = httpStatusCodes.BAD_REQUEST
            elif uploader.models.Blob.objects.count() < 1:
                response.write(json.dumps(
                    dict(count=0, msg='No objects present yet')
                ))
                response.status_code = httpStatusCodes.NOT_FOUND
            else:
                # Use first element to sample what attributes are allowed to be updated
                mappedValues = crudAPI.captureOnlyAllowedAttrsFromObj(
                    uploader.models.Blob.objects.first(), queryBody
                )

                matchedQuerySet = uploader.models.Blob.objects.filter(*mappedValues)
                if not matchedQuerySet:
                    response.status_code = httpStatusCodes.NOT_FOUND
                else:
                    if request.FILES:
                        blob = request.FILES.get('blob', None)
                        if blob is not None:
                            updateBody['content'] = blob

                    matchedQuerySet.update(**updateBody)

                response.write(json.dumps(dict(count=matchedQuerySet.count())))
                
        except Exception, e:
            print(e, 'here')
            response.status_code = httpStatusCodes.INTERNAL_SERVER_ERROR
            response.status_message = str(e)

        finally:
            return response
    elif request.method == 'DELETE':
        response = HttpResponse()
        try:
            queryBody = request.GET # TODO: Enforce param passing in through .read()
            fromUnicodeConv = dict((str(k), str(v)) for k,v in queryBody.items())
            print('fromUC', fromUnicodeConv)
            matchedQuerySet = uploader.models.Blob.objects.filter(**fromUnicodeConv)
            print('matchedQuerySet', matchedQuerySet)
            
            if matchedQuerySet:
                successful, failed = [], []
                count = matchedQuerySet.count()
                for item in matchedQuerySet:
                    try:
                        os.unlink(item.content.path)
                    except Exception, e:
                        failed.append((item.id, item.title, item.size, str(e),)) 
                    else:
                        successful.append((item.id, item.title, item.size,))

                matchedQuerySet.delete()
                response.write(
                    json.dumps(dict(count=count, successful=successful, failed=failed))
                )

        except Exception, e:
            print('e', e)
            response.status_code = httpStatusCodes.INTERNAL_SERVER_ERROR
            response.status_message = str(e)

        return response
    else:
        # Only 'GET' will have access to the serialized content
        return crudAPI.handleHTTPRequest(
            request, uploaderConstants.BLOB_TABLE_KEY, uploader.models
        )
dataset/ETHPy150Open odeke-em/restAssured/uploader/views.py/blobHandler/operator `==` -> `is`