Posted on Do 11 August 2005

Simplified "Draft" Plugin for pyblosxom

The pyblosxom plugin registry links a plugin which allows hiding "draft" stories before publishing them, so that only you can see them. Unfortunately the link to this plugin is broken. So here's my (simplified) reimplementation:

def cb_prepare(args):
        request = args["request"]
        query = request.getHttp().get('QUERY_STRING', '')

        if not query.endswith("&ignore") and not query == "ignore":
                data = request.getData()
                data["entry_list"] = filter(lambda e: not e.has_key('ignore'), data["entry_list"])

To mark a story as "draft" simply insert this at line #2:

#ignore yes

To browse unpublished stories simply append ?ignore (or &ignore) to your blog URL.

© Lennart Poettering. Built using Pelican. Theme by Giulio Fidente on github. .