Пример #1
0
def display_post(environ, post_id):
    #select id, name, content, template_view from database
    template_view = 'blog_post_view.tpl'
    _, db_title, db_content = load_from_psuedo_db('blog_entries', row_id=int(post_id))
    if not db_title: db_title = default_header
    if not db_content: db_content = default_content
    post = render(template_view, header=db_title, content=db_content)
    return post
Пример #2
0
def display_post_links(environ):
    #select all of the posts within database and display them
    db = 'blog_entries'
    posts = load_from_psuedo_db(db, all_rows=True)
    print posts
    if len(posts) == 0:
        return "0" #no posts available
    response = json.dumps(posts)
    print 'resonse:', response

    return response