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
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
def getCategories(blog_id, username, password): """docstring for getCategories""" print '---\nrunning metaWeblog.getCategories' return [cat.name for cat in Category.get_all()]