Пример #1
0
        resp = framework.ResponseDocument(request, main_constructor)
        NM = resp.doc.nodemaker
        resp.new_para("Test Management.")
        resp.doc.append(
          NM("UL", None,
            NM("LI", None,
                    NM("A", {"href": request.resolver.get_url(testcase_list)}, "Test cases."),
            ),
#            NM("LI", None,
#                    NM("A", {"href": request.resolver.get_url(testresults_list)}, "Latest test results."),
#            ),
          )
        )
        return resp.finalize()


# handlers mapped from the config.

testcase_list = webhelpers.setup_dbsession(auth.need_login(TestcaseLister()))
testcase_view = webhelpers.setup_dbsession(auth.need_login(TestcaseViewer()))
testcase_edit = webhelpers.setup_dbsession(auth.need_login(TestcaseEditor()))
testcase_create = webhelpers.setup_dbsession(auth.need_login(TestcaseCreator()))
testcase_run = webhelpers.setup_dbsession(auth.need_login(TestcaseRunner()))

main = auth.need_login(MainHandler())



if __name__ == "__main__":
    pass
Пример #2
0
        resp.doc.append(
            NM(
                "UL",
                None,
                NM(
                    "LI",
                    None,
                    NM("A", {"href": request.resolver.get_url(testcase_list)},
                       "Test cases."),
                ),
                #            NM("LI", None,
                #                    NM("A", {"href": request.resolver.get_url(testresults_list)}, "Latest test results."),
                #            ),
            ))
        return resp.finalize()


# handlers mapped from the config.

testcase_list = webhelpers.setup_dbsession(auth.need_login(TestcaseLister()))
testcase_view = webhelpers.setup_dbsession(auth.need_login(TestcaseViewer()))
testcase_edit = webhelpers.setup_dbsession(auth.need_login(TestcaseEditor()))
testcase_create = webhelpers.setup_dbsession(auth.need_login(
    TestcaseCreator()))
testcase_run = webhelpers.setup_dbsession(auth.need_login(TestcaseRunner()))

main = auth.need_login(MainHandler())

if __name__ == "__main__":
    pass
Пример #3
0
        try:
            webhelpers.dbsession.commit()
        except (DataError, IntegrityError), err:
            webhelpers.dbsession.rollback()
            request.log_error("create error: %s: %s\n" % (tablename, err))
            title = "Create new %s" % (tablename, )
            resp = self.get_response(request, title=title)
            resp.new_para(title + ", again.")
            resp.new_para(err, class_="error")
            form = resp.add_form(action=request.get_url(addentry, tablename=tablename))
            webhelpers.build_add_form(form, klass)
            return resp.finalize()
        else:
            return framework.HttpResponseRedirect(request.get_url(listtable, tablename=tablename))

addentry = auth.need_login(webhelpers.setup_dbsession(CreateRequestHandler(doc_constructor)))



class EditRequestHandler(framework.RequestHandler):

    def get(self, request, tablename=None, rowid=None):
        klass = get_model(tablename)
        dbrow = webhelpers.get_row(klass, rowid)
        title = "Edit %s %s" % (tablename, dbrow)
        resp = self.get_response(request, title=title)
        resp.new_para(title)
        form = resp.add_form(action=request.get_url(edit, tablename=tablename, rowid=rowid))
        webhelpers.build_edit_form(form, klass, dbrow)
        return resp.finalize()