def notice_to_html(notice): """return a html object from a notice """ return h.div( h.div(h.em(notice.author), ": ", notice.title, class_='notice-title'), h.div(notice.body, class_='notice-body'), class_='notice')
def show_user(request, username): div = h.div(class_='user-profile') html = h.html(h.head(h.title('user profile')), h.body(div)) if username in users: user = users[username] div.add(h.div(username, h.em('(', user.mail, ')'), class_='user')) return str(html) return tubes.Response('nothing to see here, please move along', 404)
def show_notice(request, uid): if uid in notices: notice = notices[uid] div = h.div(notice_to_html(notice), id='timeline') css = h.css('/files/style.css') html = h.html(h.head(h.title('notices'), css), h.body(div)) return str(html) return tubes.Response('nothing to see here, please move along', 404)
def get_new_notices(request): css = h.css('/files/style.css') div = h.div(id='timeline') html = h.html(h.head(h.title('notices'), css), h.body(div)) try: while True: notice = new_notices.get(0, False) div.add(notice_to_html(notice)) except Queue.Empty: pass return str(html)