Esempio n. 1
0
    def document_iterator(self, paths=False):
        """ Iterator yielding definition files in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_definition_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_definition_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'path': e.path, 'deleted': True }
            else:
                document = self.whoosh_escape_document(document)
                yield document
Esempio n. 2
0
    def document_iterator(self, paths=False):
        """ Iterator yielding definition files in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_definition_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_definition_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'path': e.path, 'deleted': True }
            except lib_xml.InvalidXmlError as e:
                raise
            else:
                del document['revisions']
                document = self.whoosh_escape_document(document)
                document['min_schema_version'] = self.version_to_int(document['min_schema_version'])
                yield document
Esempio n. 3
0
    def document_iterator(self, paths=False):
        """ Iterator yielding definition files in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_definition_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_definition_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'path': e.path, 'deleted': True }
            except lib_xml.InvalidXmlError as e:
                raise
            else:
                del document['revisions']
                document = self.whoosh_escape_document(document)
                document['min_schema_version'] = self.version_to_int(document['min_schema_version'])
                yield document
Esempio n. 4
0
    def document_iterator(self, paths=False):
        """ Iterator yielding definition revisions in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_definition_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_definition_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'oval_id': lib_repo.path_to_oval_id(e.path), 'deleted': True }
            except lib_xml.InvalidXmlError as e:
                raise
            else:
                oval_id = document['oval_id']
                for revision in document['revisions']:
                    revision['oval_id'] = oval_id
                    revision = self.whoosh_escape_document(revision)
                    yield revision
Esempio n. 5
0
    def document_iterator(self, paths=False):
        """ Iterator yielding definition revisions in repo as indexable documents. """

        if not paths:
            # get all in repo
            paths = lib_repo.get_definition_paths_iterator()

        for path in paths:
            try:
                document = lib_xml.get_definition_metadata(path)
            except lib_xml.InvalidPathError as e:
                yield { 'oval_id': lib_repo.path_to_oval_id(e.path), 'deleted': True }
            except lib_xml.InvalidXmlError as e:
                raise
            else:
                oval_id = document['oval_id']
                for revision in document['revisions']:
                    revision['oval_id'] = oval_id
                    revision = self.whoosh_escape_document(revision)
                    yield revision