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), )
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)
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)))
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 )
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>""")