def inject(self, state, response):
        """ Inject Debug Toolbar code to response body. """
        html = yield from self.app.ps.jinja2.render(
            'debugtoolbar/inject.html',
            static_path=self.cfg.prefix + 'static',
            toolbar_url=self.cfg.prefix + state.id,
        )
        html = html.encode(state.request.charset or 'utf-8')
        response.body = RE_BODY.sub(html + b'</body>', response.body)
        return response
def inject ( self , state , response ) : html = yield from self . app . ps . jinja2 . render ( 'debugtoolbar/inject.html' , static_path = self . cfg . prefix + 'static' , toolbar_url = self . cfg . prefix + state . id , ) html = html . encode ( state . request . charset or 'utf-8' ) response . body = RE_BODY . sub ( html + b'</body>' , response . body ) return response
Inject Debug Toolbar code to response body.