Ejemplo n.º 1
0
    def _footer(self):
        """
        Add editor to the footer.
        """

        output = ""
        # Not using tiddlyweb.web.util:get_route_value to avoid
        # ValueError
        routing_args = self.environ["wsgiorg.routing_args"][1]
        config = self.environ["tiddlyweb.config"]
        if "tiddlyeditor_tiddlers" in config:
            tiddler_name = routing_args.get("tiddler_name", None)
            recipe_name = routing_args.get("recipe_name", "")
            bag_name = routing_args.get("bag_name", "")
            revision = routing_args.get("revision", None)
            server_prefix = config["server_prefix"]

            if tiddler_name and not revision:
                output = """
<div id="edit">
    <a href="%s/tiddlyeditor?tiddler=%s;bag=%s;recipe=%s">TiddlyEdit</a>
</div>
""" % (
                    server_prefix,
                    tiddler_name,
                    bag_name,
                    recipe_name,
                )
        original_footer = HTML._footer(self)
        if output:
            head, sep, tail = original_footer.partition('<div id="badge">')
            return head + output + sep + tail
        return original_footer