示例#1
0
文件: main.py 项目: mcaudy/tubes
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)
示例#2
0
文件: main.py 项目: mcaudy/tubes
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)
示例#3
0
文件: main.py 项目: mcaudy/tubes
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)
示例#4
0
文件: main.py 项目: mcaudy/tubes
def show_stream(request, username):
    if username == '':
        notices = stream
    elif username in user_notices:
        notices = user_notices[username]
    else:
        return tubes.Response('nothing to see here, please move along', 404)

    content = [notice_to_html(notices) for notice in notices]
    css = h.css('/files/style.css')
    html = h.html(h.head(h.title('notices'), css), h.body(*content))

    return str(html)