예제 #1
0
파일: index.py 프로젝트: SinSiXX/A858nalyze
def single_message():
	id = form["id"].value
	for key in db.keys():
		if ("-%s-" % id) in key:
			post = db[key]
			break
	else:
		return "Unknown message: %s" % id

	return html.body(
		html.h1(html.escape(post["data"]["title"])),
		format_post(post),
	)
예제 #2
0
def single_message():
    id = form["id"].value
    for key in db.keys():
        if ("-%s-" % id) in key:
            post = db[key]
            break
    else:
        return "Unknown message: %s" % id

    return html.body(
        html.h1(html.escape(post["data"]["title"])),
        format_post(post),
    )
예제 #3
0
def list_messages():
    # Which messages to show?
    messages = list(reversed(sorted(db.keys())))
    if "start" in form:
        start = int(form["start"].value)
    else:
        start = 0
    page_messages = messages[start:start + MESSAGES_PER_PAGE]
    pager = gen_pager(messages, start)

    return html.body(
        pager, html.h1("a858 auto-analysis"), credits(),
        html.div(*map(lambda key: format_post(db[key]), page_messages)), pager)
예제 #4
0
파일: main.py 프로젝트: banthar/code-review
def html_page(title, *content, **arguments):
    head = html.head(
        html.link(rel="shortcut icon", href=config["favicon"]),
        html.title("{} - {}".format(title, config["title"])),
        html.style(style),
    )
    nav = html.nav(
        html.ul(
            html.li(html.a("⚗", href=html.absolute())),
            html.li(html.a("Reviews", href=html.absolute("reviews"))),
            html.li(html.a("Commits", href=html.absolute("commits", repo.head.ref.name))),
            html.li(html.a("Tree", href=html.absolute("tree", repo.head.ref.name))),
            html.li(html.a("Refs", href=html.absolute("refs"))),
        )
    )
    return http.Html(html.html(head, html.body(*((nav,) + content + (html.script(script),)), **arguments)))
예제 #5
0
def list_messages():
	# Which messages to show?
	messages = list(reversed(sorted(db.keys())))
	if "start" in form:
		start = int(form["start"].value)
	else:
		start = 0
	page_messages = messages[start:start + MESSAGES_PER_PAGE]
	pager = gen_pager(messages, start)

	return html.body(
		pager,
		html.h1("a858 auto-analysis"),
		html.div(*map(lambda key: format_post(db[key]),
		              page_messages)),
		pager
	)
예제 #6
0
    def test(self) :
        self.assertEquals(breaks("hello world"),"\nhello world\n")
        self.assertEquals(p('hello world'),"<p>hello world</p>")
        self.assertEquals(div('hello world'),"<div>hello world</div>")
        self.assertEquals(div({'class':'myclass','id':'myd'},'hello world'),
                              """<div class="myclass" id="myd">hello world</div>""")

        self.assertEquals(div('a','b'),'<div>ab</div>')

        self.assertEquals(p(),'<p/>')

        self.assertEquals(html(
            head(),
            body(
                h2("Header"),
                p('para1'),
                p('para2')
                )),
            """<html><head/><body><h2>Header</h2><p>para1</p><p>para2</p></body></html>""")