Пример #1
0
def add_comment(name, mail, url, text, post_id):
    """ Add a comment to a specific post. """
    if not psblog.existing_post_id(post_id):
        return # no post to comment on
    new_comment = {
        "mail": mail,
        "name": cgi.escape(name),
        "url": cgi.escape(url, True),
        "text": cgi.escape(text)
    }
    current = psblog.get_comments(post_id)
    current.append(new_comment)
    psblog.save_comments(current, post_id)
Пример #2
0
def rm_post(post_id):
    """ Remove a page (removes only the data files). """
    if psblog.existing_post_id(post_id):
        os.remove(post_id+".txt")
        os.remove(post_id+".meta")
        os.remove(post_id+".comments")