def file_complete(self, file_size):
        """
        Return a file object if we're activated.
        """
        if not self.activated:
            return

        self.file.seek(0)
        upload_content = email.message_from_file(self.file)

        def get_value(dict, name):
            value = dict.get(name, None)
            if value is None:
                raise Exception('Missing field %s.' % (field_name, name))
            return value

        content_type = get_value(upload_content, 'content-type')
        size = get_value(upload_content, 'content-length')
        gs_object_name = upload_content.get(CLOUD_STORAGE_OBJECT_HEADER, None)

        kwargs = {
            'blob_key': self.blobkey,
            'name': self.file_name,
            'content_type': content_type,
            'size': int(size),
            'charset': self.charset,
        }

        return AppEngineUploadedFile(**kwargs)
dataset/ETHPy150Open django-nonrel/djangoappengine/djangoappengine/storage.py/AppEngineFileUploadHandler.file_complete/original