How to use the sqlakeyset.results.Paging function in sqlakeyset

To help you get started, we’ve selected a few sqlakeyset examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / vulncode-db / app / vulnerability / views / vulncode_db.py View on Github external
else:
        for columns in target_entries:
            vulnerability = columns[0]
            nvd = columns[1]
            if len(columns) > 2 and type(columns[2]) is bool:
                annotation_exists = columns[2]
                vulnerability.set_has_annotations(annotation_exists)

            vuln_view = VulnerabilityView(vulnerability, nvd, preview=True)
            new_entries.append(vuln_view)

    del target_entries[:]
    target_entries.extend(new_entries)


class VulnViewTypesetPaginationObjectWrapper(Paging):
    """
    An sqlakeyset Paging object wrapper class which wraps Vuln/Nvd rows
    inside a VulnView.
    """
    def __init__(self, paginationObject):
        """
        :param paginationObject: A Flask SQLalchemy Pagination object.
        """
        self.__class__ = type(
            paginationObject.__class__.__name__,
            (self.__class__, paginationObject.__class__),
            {},
        )
        self.__dict__ = paginationObject.__dict__
        self.total = 0
        wrap_entries(self.rows)