コード例 #1
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
コード例 #2
0
ファイル: metaweblog.py プロジェクト: cnf/MarkedImp
def newPost(blog_id, username, password, struct, publish):
    """docstring for newPost"""
    print '---\nrunning metaWeblog.newPost'
    if blog_id == 'Static':
        page = Page(title=struct['title'], content=struct['description'], draft=not publish)
        page.slug = struct['link']
    else:
        page = Post(title=struct['title'], content=struct['description'], 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 page.slug
コード例 #3
0
ファイル: metaweblog.py プロジェクト: cnf/MarkedImp
def getCategories(blog_id, username, password):
    """docstring for getCategories"""
    print '---\nrunning metaWeblog.getCategories'
    return [cat.name for cat in Category.get_all()]