コード例 #1
0
            else:
                doc.append(html.Para(args[0] + " : no such table"))

            return self.endResponse()

        list = html.UL()
        for table in self.dbsess.db.app.getTableList():
            p = html.Para()
            p.append(html.Href("report/" + table.getTableName(), table.getTableName()))
            p.append("")
            p.append(str(len(self.dbsess.query(table._instanceClass))))
            list.append(p)
        doc.append(list)

        doc.append(html.Para("This is the report page"))
        doc.append(html.Para("args : " + repr(args)))
        doc.append(html.Para("kw : " + repr(kw)))
        doc.append(html.Para("dbsess : " + repr(self.dbsess)))

        return self.endResponse()

    report.exposed = True


syscon.setToolkit(HtmlServer())
sess = demo.startup()
cherrypy.root = MyRoot(sess)

cherrypy.server.start()
sess.shutdown()
コード例 #2
0
def install():
    check()
    syscon.setToolkit(_toolkit)
コード例 #3
0
def runApplication(app):
    check()
    syscon.setToolkit(_toolkit)
    syscon._session.app = app
    _toolkit.run_forever(syscon._session)
コード例 #4
0
            tcl = self.dbsess.getTableClass(args[0])
            if tcl is not None:
                rpt = self.dbsess.getViewReport(tcl, *args[1:], **kw)
                showReport(doc, rpt)
            else:
                doc.append(html.P(args[0] + " : no such table"))

            return self.endResponse()
        list = html.UL()
        doc.append(list)
        for table in self.dbsess.db.app.getTableList():
            li = html.LI()
            list.append(li)
            li.append(
                html.A(table.getLabel(),
                       href="report/" + table.getTableName()))
            li.append(" (%d rows)" %
                      len(self.dbsess.query(table._instanceClass)))

        return self.endResponse()

    report.exposed = True


syscon.setToolkit(HtmlServer())
sess = pinboard_demo.startup()
cherrypy.root = MyRoot(sess)

cherrypy.server.start()
sess.shutdown()