Ejemplo n.º 1
0
def page(page):
    conn = sqlite3.connect(database)
    posts = manager.getBlogPosts(conn, page)
    pages = manager.getPageCount(conn)
    menu = manager.getStaticItem(conn, "Menu")
    sidebar = []
    for i in config.sidebar_statics:
        sitem = manager.getStaticItem(conn, i)
        sidebar.append(sitem)

    conn.close()
    return bottle.template('blog_frontpage', posts=posts, pages=pages,
        page=page, menu=menu, sidebar_items = sidebar, config = config)
Ejemplo n.º 2
0
def static_page(name):
    conn = sqlite3.connect(database)
    item_title = name.replace('+', ' ')
    item = manager.getStaticItem(conn, item_title)
    posts = manager.getBlogPosts(conn, 1)
    menu = manager.getStaticItem(conn, "Menu")

    sidebar = []
    for i in config.sidebar_statics:
        sitem = manager.getStaticItem(conn, i)
        sidebar.append(sitem)

    if item == None:
        return bottle.HTTPError(404, "Page not found")

    conn.close()

    return bottle.template('blog_static_item', item=item, comments=None, 
        posts=posts, menu = menu, config = config, sidebar_items = sidebar)