def POSTING(message, post_name=None, host=None, action=None): name, address = parseaddr(message['from']) if not action: post.post(post_name, address, host, message) msg = view.respond(locals(), 'mail/page_ready.msg', From="noreply@%(host)s", To=message['from'], Subject="Your page '%(post_name)s' is ready.") relay.deliver(msg) # first real message, now we can index it index_q = queue.Queue("run/posts") index_q.push(message) elif action == "delete": post.delete(post_name, address) msg = view.respond(locals(), 'mail/deleted.msg', From="noreply@%(host)s", To=message['from'], Subject="Your page '%(post_name)s' was deleted.") relay.deliver(msg) else: logging.debug("Invalid action: %r", action) return POSTING
def test_delete(): test_post() post.delete(blog, user) assert post.user_exists(user), "User dir should stay." assert not os.path.exists(post.blog_file_name(blog, user)), "File should go."