예제 #1
0
def delete_all_categories(author):
    """Delete all categories of specified author

    When delete a category, all items belonging to as well a its all
    comments would be delete automatically
    :param author the specified author
    """
    category_query = rankdata.Category.all().filter("author = ", author)
    for category in category_query.run():
        item.delete_all_items(author, category.name)
        db.delete(category)
예제 #2
0
def delete_categories(author, names=[]):
    """Delete categories of specified author and name

    When delete a category, all items belonging to as well as its all
    comments would be delete automatically.
    :param author the specified author
    :param names the specified name list
    """
    for name in names:
        key = db.Key.from_path("Category", "{author}/{category}".format(author=author, category=name))
        item.delete_all_items(author, db.get(key).name)
        db.delete(key)