pelican/plugins/data_files/generators.py
def _get_data_files(self):
        """Return list of valid files to load into context"""

        data_dir = pathlib.Path(self.settings["DATA_FILES_DIR"])
        valid_files = []

        # turn path into absolute if not already
        if not data_dir.is_absolute():
            data_dir = pathlib.Path(self.settings["PATH"]).joinpath(data_dir)

        # check if path exists
        if not data_dir.exists():
            log.error("pelican-data-files: DATA_FILES_DIR path doesn't exists.")
            exit(1)

        if not data_dir.is_dir():
            log.error("pelican-data-files: DATA_FILES_DIR path isn't a directory.")
            exit(1)

        # return all valid files in path
        # TODO check for duplicates (eg: profile.json and profile.yaml)
        for file in data_dir.iterdir():
            if self._is_valid_file(file):
                valid_files.append(file)

        return valid_files
Return list of valid files to load into context
Return list of valid files to load into context
Return list of valid files to load into context
def _get_data_files(self):
        data_dir = pathlib.Path(self.settings["DATA_FILES_DIR"])
        valid_files = []
        if not data_dir.is_absolute():
            data_dir = pathlib.Path(self.settings["PATH"]).joinpath(data_dir)
        if not data_dir.exists():
            log.error("pelican-data-files: DATA_FILES_DIR path doesn't exists.")
            exit(1)
        if not data_dir.is_dir():
            log.error("pelican-data-files: DATA_FILES_DIR path isn't a directory.")
            exit(1)
        for file in data_dir.iterdir():
            if self._is_valid_file(file):
                valid_files.append(file)
        return valid_files
def _get_data_files ( self ) : data_dir = pathlib . Path ( self . settings [ "DATA_FILES_DIR" ] ) valid_files = [ ] if not data_dir . is_absolute ( ) : data_dir = pathlib . Path ( self . settings [ "PATH" ] ) . joinpath ( data_dir ) if not data_dir . exists ( ) : log . error ( "pelican-data-files: DATA_FILES_DIR path doesn't exists." ) exit ( 1 ) if not data_dir . is_dir ( ) : log . error ( "pelican-data-files: DATA_FILES_DIR path isn't a directory." ) exit ( 1 ) for file in data_dir . iterdir ( ) : if self . _is_valid_file ( file ) : valid_files . append ( file ) return valid_files
Return list of valid files to load into context
Return list of valid files to load into context
"""Return list of valid files to load into context""" # turn path into absolute if not already # check if path exists # return all valid files in path # TODO check for duplicates (eg: profile.json and profile.yaml)
self