def _get_readme(self, repository_format): if repository_format == constants.RepositoryFormat.MULTI: try: return readmeutils.get_readme(directory=self.path) except readmeutils.FileSizeError as e: self.log.warning(e) return None
def _load_collection_readme(self): if not self.collection_info.readme: raise exc.ManifestValidationError('No readme listed in manifest') readme_path = os.path.join(self.path, self.collection_info.readme) try: readme_file = readmeutils.get_readme(directory=self.path, filename=readme_path) except readmeutils.FileSizeError as e: raise exc.ManifestValidationError( 'Manifest readme FileSizeError: {}'.format(e)) if not readme_file: raise exc.ManifestValidationError( 'Readme listed in manifest not found: ' '{}'.format(self.collection_info.readme)) if readme_file.mimetype not in ALLOWED_TYPES: raise exc.ManifestValidationError( 'Readme type must be in {}'.format(ALLOWED_TYPES)) html = readmeutils.render_html(readme_file) self.readme = { 'mimetype': readme_file.mimetype, 'text': readme_file.text, 'html': html, }
def _get_readme(self, directory=None): try: return readmeutils.get_readme(directory or self.path, self.root) except readmeutils.FileSizeError as e: self.log.warning(e)