Example #1
0
    def get_noticeboard(self, repository_id):
        """
        Return noticeboard RSS metadata (dict form) for given repository
        identifier.
        This method is fault tolerant, except for invalid repository_id given,
        if repository notice board file is broken or not found an empty dict
        is returned.

        @param repository_id: repository identifier
        @type repository_id: string
        @return: repository metadata
        @rtype: dict
        @raise KeyError: if given repository identifier is not available
        """
        repo_data = self._settings['repositories']['available'][repository_id]
        nb_path = repo_data['local_notice_board']

        if not const_file_readable(nb_path):
            return {} # not found

        # load RSS metadata and return if valid
        myrss = RSS(nb_path, '', '')
        data, data_len = myrss.get_entries()

        if data is None:
            return {}
        return data
Example #2
0
    def data(self):
        """
        Return the noticeboard RSS metadata.

        This method is fault tolerant, except for invalid repository_id given,
        if repository notice board file is broken or not found an empty dict
        is returned.

        @return: repository metadata
        @rtype: dict
        @raise KeyError: if given repository identifier is not available
        """
        avail_data = self._settings['repositories']['available']
        nb_path = avail_data[self._repository_id]['local_notice_board']

        if not const_file_readable(nb_path):
            return {}  # not found

        myrss = RSS(nb_path, '', '')
        data, data_len = myrss.get_entries()

        if data is None:
            return {}
        return data
Example #3
0
    def data(self):
        """
        Return the noticeboard RSS metadata.

        This method is fault tolerant, except for invalid repository_id given,
        if repository notice board file is broken or not found an empty dict
        is returned.

        @return: repository metadata
        @rtype: dict
        @raise KeyError: if given repository identifier is not available
        """
        avail_data = self._settings['repositories']['available']
        nb_path = avail_data[self._repository_id]['local_notice_board']

        if not const_file_readable(nb_path):
            return {} # not found

        myrss = RSS(nb_path, '', '')
        data, data_len = myrss.get_entries()

        if data is None:
            return {}
        return data