예제 #1
0
파일: metaweblog.py 프로젝트: cnf/MarkedImp
def getRecentPosts(blog_id, username, password, numberOfPosts):
    """docstring for getRecentPosts"""
    print '---\nrunning metaWeblog.getRecentPosts'
    if blog_id == 'Static':
        return [page_to_struct(page) for page in Page.get_all(numberOfPosts)]
    else:
        return [page_to_struct(page) for page in Post.get_all(numberOfPosts)]
예제 #2
0
파일: metaweblog.py 프로젝트: cnf/MarkedImp
def deletePost(appKey, post_id, username, password, publish):
    """docstring for deletePost"""
    page = Post.get_by_slug(post_id)
    try:
        page.delete()
    except IntegrityError:
        raise Fault("DBase Error", "No success...")
    else:
        return True
예제 #3
0
파일: metaweblog.py 프로젝트: cnf/MarkedImp
def editPost(post_id, username, password, struct, publish):
    """docstring for editPost"""
    print '---\nrunning metaWeblog.editPost'
    page = Post.get_by_slug(post_id)
    page.title      = struct['title']
    page.content    = struct['description']
    page.draft      = not publish
    if 'categories' in struct:
        page.categories = [Category.get_by_name(cat) for cat in struct['categories']]
    else:
        page.categories = []
    try:
        page.save()
    except IntegrityError:
        raise Fault("DBase Error", "Title not unique")
    else:
        return True
예제 #4
0
파일: metaweblog.py 프로젝트: cnf/MarkedImp
def getPost(post_id, username, password):
    """docstring for getPost"""
    print '---\nrunning metaWeblog.getPost'
    return page_to_struct(Post.get_by_slug(post_id))
예제 #5
0
파일: views.py 프로젝트: cnf/MarkedImp
def page(slug):
    """docstring for show_page"""
    page = Post.get_by_slug(slug)
    response = make_response(render_template('page.html', page=page))
    response.headers['Last-Modified'] = page.updated_at.strftime('%a, %d %b %Y %H:%M:%S GMT')
    return response
예제 #6
0
파일: views.py 프로젝트: cnf/MarkedImp
def pages():
    """docstring for pages"""
    page_list = Post.get_all()
    return render_template('pages.html', page_list=page_list)