Exemplo n.º 1
0
    def validate_author_image_exists(self):
        if self.metadata_content.get(PACK_METADATA_SUPPORT) == 'partner':
            author_image_path = os.path.join(self.pack_path, 'Author_image.png')
            if not os.path.exists(author_image_path):
                if self._add_error(Errors.author_image_is_missing(author_image_path), file_path=author_image_path):
                    return False

        return True
Exemplo n.º 2
0
 def is_valid(self) -> bool:
     """
     Checks whether author image is valid.
     Returns:
         (bool): Whether author image is valid.
     """
     if os.path.exists(self.file_path):
         self.validate_size(allow_empty_image_file=False, maximum_size=self.maximum_image_size)
     else:
         if self.get_support_level() == 'partner':
             error_message, error_code = Errors.author_image_is_missing(self.file_path)
             if self.handle_error(error_message, error_code, file_path=self.file_path):
                 self._is_valid = False
     return self._is_valid