in assets/assets/utils/common_utils.py [0:0]
def is_blank_created(self) -> bool:
"""
Checks if blank row in database was created
"""
logger_.debug(f"Checking is_blank_created {self.file_name}")
file_to_upload = self.file_bytes
file_name = self.file_name
ext = self.ext
original_ext = ""
self.new_file = db.service.insert_file(
self.session,
file_name,
self.storage.tenant,
get_file_size(file_to_upload),
ext,
original_ext,
get_mimetype(file_to_upload),
get_pages(file_to_upload, ext),
schemas.FileProcessingStatus.UPLOADING,
)
if ext in (".txt", ".html"):
self.storage.upload_obj(
target_path=self.new_file.path,
file=BytesIO(self.file_bytes),
)
else:
minio_utils.upload_in_minio( # noqa
storage=self.storage,
file=file_to_upload,
file_obj=self.new_file,
)
if self.new_file:
return True
self.response = to_dict(
id_=None,
action=self.action,
action_status=False,
message="Database error",
name=self.file_name,
)
return False