Beispiel #1
0
    def test_find_ctag(self):
        self.assertEqual(qry.find_ctag(self.session, "swap")[0], 8)

        ctags = qry.find_ctag(self.session, "swap", "gnubg")
        self.assertEqual(ctags[0], 5)
        self.assertTrue({'path': 'eval.c', 'line': 1747,
                        'version': u'0.90+20091206-4', 'package': u'gnubg'}
                        in ctags[1])
Beispiel #2
0
    def test_find_ctag(self):
        self.assertEqual(qry.find_ctag(self.session, "swap")[0], 8)

        ctags = qry.find_ctag(self.session, "swap", "gnubg")
        self.assertEqual(ctags[0], 5)
        self.assertTrue({
            'path': 'eval.c',
            'line': 1747,
            'version': u'0.90+20091206-4',
            'package': u'gnubg'
        } in ctags[1])
Beispiel #3
0
    def test_find_ctag(self):
        self.assertEqual(qry.find_ctag(self.session, "swap")[0], 8)

        ctags = qry.find_ctag(self.session, "swap", "gnubg")
        self.assertEqual(ctags[0], 5)
        self.assertTrue({
            "path": Path("eval.c"),
            "line": 1747,
            "version": u"0.90+20091206-4",
            "package": u"gnubg",
        } in ctags[1])
Beispiel #4
0
    def get_objects(self):
        """
        Returns the places where ctag are found.
        (limit to package if package is not None)
        """
        try:
            page = int(request.args.get("page"))
        except Exception:
            page = 1
        ctag = request.args.get("ctag")
        package = request.args.get("package") or None

        # pagination:
        if self.d.get("pagination"):
            try:
                offset = int(current_app.config.get("LIST_OFFSET"))
            except Exception:
                offset = 60
            start = (page - 1) * offset
            end = start + offset
            slice_ = (start, end)
        else:
            pagination = None
            slice_ = None

        (count, results) = qry.find_ctag(session,
                                         ctag,
                                         slice_=slice_,
                                         package=package)
        if self.d.get("pagination"):
            pagination = Pagination(page, offset, count)
        else:
            pagination = None

        return dict(
            results=results,
            ctag=ctag,
            count=count,
            page=page,
            package=package,
            pagination=pagination,
        )
Beispiel #5
0
    def get_objects(self):
        """
        Returns the places where ctag are found.
        (limit to package if package is not None)
        """
        try:
            page = int(request.args.get("page"))
        except:
            page = 1
        ctag = request.args.get("ctag")
        package = request.args.get("package") or None

        # pagination:
        if self.d.get('pagination'):
            try:
                offset = int(current_app.config.get("LIST_OFFSET"))
            except:
                offset = 60
            start = (page - 1) * offset
            end = start + offset
            slice_ = (start, end)
        else:
            pagination = None
            slice_ = None

        (count, results) = qry.find_ctag(session, ctag, slice_=slice_,
                                         package=package)
        if self.d.get('pagination'):
            pagination = Pagination(page, offset, count)
        else:
            pagination = None

        return dict(results=results,
                    ctag=ctag,
                    count=count,
                    page=page,
                    package=package,
                    pagination=pagination)