Пример #1
0
def blogger_delete_post(post_id, username, password, publish):
    request = login(username, password)
    entry = Post.query.get(post_id)
    if entry is None or entry.content_type != 'post':
        raise Fault(404, 'No such post')
    db.delete(entry)
    db.commit()
    return True
Пример #2
0
def blogger_delete_post(post_id, username, password, publish):
    request = login(username, password)
    entry = Post.query.get(post_id)
    if entry is None or entry.content_type != 'post':
        raise Fault(404, 'No such post')
    db.delete(entry)
    db.commit()
    return True
Пример #3
0
def wp_delete_category(blog_id, username, password, category_id):
    request = login(username, password)
    if not request.user.has_privilege(MANAGE_CATEGORIES):
        raise Fault(403, 'you are not allowed to manage categories')
    category = Category.query.get(category_id)
    if category is None:
        raise Fault(404, 'no such category')
    db.delete(category)
    db.commit()
    return category.id
Пример #4
0
def wp_delete_page(blog_id, username, password, page_id):
    request = login(username, password)
    page = Post.query.get(page_id)
    if page is None or page.content_type != 'page':
        raise Fault(404, 'no such page')
    if not page.can_edit():
        raise Fault(403, 'you don\'t have privilegs to this post')
    db.delete(page)
    db.commit()
    return True
Пример #5
0
def wp_delete_category(blog_id, username, password, category_id):
    request = login(username, password)
    if not request.user.has_privilege(MANAGE_CATEGORIES):
        raise Fault(403, 'you are not allowed to manage categories')
    category = Category.query.get(category_id)
    if category is None:
        raise Fault(404, 'no such category')
    db.delete(category)
    db.commit()
    return category.id
Пример #6
0
def wp_delete_page(blog_id, username, password, page_id):
    request = login(username, password)
    page = Post.query.get(page_id)
    if page is None or page.content_type != 'page':
        raise Fault(404, 'no such page')
    if not page.can_edit():
        raise Fault(403, 'you don\'t have privilegs to this post')
    db.delete(page)
    db.commit()
    return True