All pastes #264977 Raw Edit

Trac's wiki in other

public python v1 · immutable
·published 2006-12-02 21:53 UTC
rendered paste body
# -*- coding: utf-8 -*-from trac.wiki.formatter import wiki_to_htmlfrom trac.env import Environmentfrom trac.web.api import Requestfrom trac.config import Configurationfrom trac import db_defaultfrom trac.web.href import Hreffrom ConfigParser import ConfigParserimport os.pathclass Conf(Configuration):    def __init__(self):        self._defaults = {}        self.filename = None        self.parser = ConfigParser()        self._lastmtime = 0        self.site_filename = None        self.site_parser = None        self._lastsitemtime = 0class Env(Environment):    def __init__(self, href, *args, **kw):        Environment.__init__(self, *args, **kw)        self.href = self.abs_href = Href(href)        def verify(self):        pass            def load_config(self):        self.config = Conf()        for section, name, value in db_default.default_config:            self.config.setdefault(section, name, value)                def setup_log(self):        class DummyLogger:            """The world's most fake logger."""            def __noop(self, *args, **kwargs):                pass            debug = info = warning = error = critical = log = exception = __noop            warn = fatal = __noop            getEffectiveLevel = lambda self: 0            isEnabledFor = lambda self, level: 0        self.log = DummyLogger()        def wikify(content, href):    env = Env(href, os.path.abspath("."))    req = Request()        return wiki_to_html(content, env, req, db=1, absurls=0, escape_newlines=False)