@method_decorator(logged_in_or_basicauth(AUTH_REALM))
    @method_decorator(group_required(API_GROUP_NAME))  # FIXME: Should be more granular permissions
    def put(self, request, code, suggested_format=None):
        context = {'request': request}
        conten_type = request.content_type
        uploaded_obj = None
        if 'multipart/form-data' in conten_type:
            # We have a file upload encoded with multipart/form-data
            file_content = StringIO(request.body)
            parser = MultiPartParser()
            dnf = parser.parse(file_content, media_type=conten_type, parser_context=context)
            extra = dnf.data
            if 'file' in dnf.files:
                uploaded_obj = dnf.files['file']
        else:
            extra = request.QUERY_PARAMS
        # TODO: do we require SQL tagging logic in this API call?
        sql_tag_string = extra.get('tag_string', None)
        sql_remove_tag_string = extra.get('remove_tag_string', None)
        new_name = extra.get('new_name', None)
        new_type = extra.get('new_type', None)
        index_data = extra.get('indexing_data', None)
        if index_data:
            index_data = json.loads(index_data)
        processor = DocumentProcessor()
        options = {
            'tag_string': sql_tag_string,
            'remove_tag_string': sql_remove_tag_string,
            'extension': suggested_format,
            'new_name': new_name,
            'new_type': new_type,
            'new_indexes': index_data,
            'update_file': uploaded_obj,
            'user': request.user,
        }
        document = processor.update(code, options)
        if len(processor.errors) > 0:
            log.error('FileHandler.update manager errors %s' % processor.errors)
            if settings.DEBUG:
                print processor.errors
                raise Exception('FileHandler.update manager errors')
            else:
                return Response(status=status.HTTP_400_BAD_REQUEST)
        log.info('FileHandler.update request fulfilled for code: %s, extension: %s'
                 % (code, suggested_format))
        resp = DMSOBjectRevisionsData(document).data
        return Response(resp, status=status.HTTP_200_OK)
Used to work with "update" sequence of DMS code.
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/api/views.py/FileHandler.put