def serve(self, key, format='html'): page = get_static_page(key) if page is None: return abort(404, _('The requested page was not found')) data = { 'static': page, 'body_html': render_body(page.body), 'active_global_nav': key, } if format == 'simple': return render('/plain_doc.html', data) elif format == 'overlay': return render('/static/show.html', data, overlay=True) else: return render('/static/show.html', data)
def serve(self, key, format='html'): page = get_static_page(key) if page is None: return abort(404, _('The requested page was not found')) c.body_css_classes += page.css_classes data = { 'static': page, 'body_html': render_body(page.body), 'active_global_nav': key, } if format == 'simple': return render('/plain_doc.html', data) elif format == 'overlay': return render('/static/show.html', data, overlay=True) else: return render('/static/show.html', data)
def test_staticpage(self): from adhocracy.lib.staticpage import render_body r = render_body(u'<a href="http://example.com/">link</a>') self.assertTrue(u'href="http://example' not in r)