f8f5eb96468aa94acad1c085fc9a8c80d7b6db8f,app/evaluation/widgets/uploader.py,AjaxUploadWidget,handle_ajax,#AjaxUploadWidget#Any#,72

Before Change



        result = []
        for uploaded_file in request.FILES.values():
            new_staged_file = StagedFile.objects.create(
                    timeout=datetime.datetime.utcnow() + self.timeout,
                    file=uploaded_file
                )
            result.append({
                "filename": uploaded_file.name,
                "uuid": new_staged_file.id,
                "extra_attrs": {}
            });

After Change


            return HttpResponseBadRequest()

        csrf_token = request.META.get("CSRF_COOKIE", None)
        if not csrf_token:
            return HttpResponseForbidden("CSRF token is missing")

        if "HTTP_CONTENT_RANGE" in request.META:
            handler = self._handle_chunked
        else:
            handler = self._handle_complete

        result = []
        try:
            for uploaded_file in request.FILES.values():
                result.append(handler(request, csrf_token, uploaded_file))
        except InvalidRequestException as e:
            return HttpResponseBadRequest(str(e))

        return JsonResponse(result, safe=False)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: comic/grand-challenge.org
Commit Name: f8f5eb96468aa94acad1c085fc9a8c80d7b6db8f
Time: 2017-11-15
Author: pkcakeout@gmail.com
File Name: app/evaluation/widgets/uploader.py
Class Name: AjaxUploadWidget
Method Name: handle_ajax


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: 3d95ae5cd11987e4c963baf4da374b1fa139b807
Time: 2016-06-29
Author: carlos.torres@rackspace.com
File Name: perfkitbenchmarker/providers/openstack/os_virtual_machine.py
Class Name: OpenStackVirtualMachine
Method Name: _GetSchedulerHints


Project Name: comic/grand-challenge.org
Commit Name: a8eab99a0476060c27ae890071a5e17c01531ee7
Time: 2020-01-27
Author: 57257130+MikeOverkamp-diag@users.noreply.github.com
File Name: app/grandchallenge/reader_studies/models.py
Class Name: ReaderStudy
Method Name: add_ground_truth