# -*- test-case-name: twisted.web.test.test_html -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """I hold HTML generation helpers. """ from twisted.python import log from twisted.python.compat import NativeStringIO as StringIO, escape from twisted.python.deprecate import deprecated from incremental import Version @deprecated(Version('Twisted', 15, 3, 0), replacement='twisted.web.template') def PRE(text): "Wrap <pre> tags around some text and HTML-escape it." return "<pre>"+escape(text)+"</pre>" @deprecated(Version('Twisted', 15, 3, 0), replacement='twisted.web.template') def UL(lst): io = StringIO() io.write("<ul>\n") for el in lst: io.write("<li> %s</li>\n" % el) io.write("</ul>") return io.getvalue() @deprecated(Version('Twisted', 15, 3, 0), replacement='twisted.web.template') def linkList(lst): io = StringIO() io.write("<ul>\n") for hr, el in lst: io.write('<li> <a href="%s">%s</a></li>\n' % (hr, el)) io.write("</ul>") return io.getvalue() @deprecated(Version('Twisted', 15, 3, 0), replacement='twisted.web.template') def output(func, *args, **kw): """output(func, *args, **kw) -> html string Either return the result of a function (which presumably returns an HTML-legal string) or a sparse HTMLized error message and a message in the server log. """ try: return func(*args, **kw) except: log.msg("Error calling %r:" % (func,)) log.err() return PRE("An error occurred.")
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
_auth | Folder | 0755 |
|
|
test | Folder | 0755 |
|
|
__init__.py | File | 699 B | 0644 |
|
_element.py | File | 5.81 KB | 0644 |
|
_flatten.py | File | 15.54 KB | 0644 |
|
_http2.py | File | 48 KB | 0644 |
|
_newclient.py | File | 61.84 KB | 0644 |
|
_responses.py | File | 3.57 KB | 0644 |
|
_stan.py | File | 10.54 KB | 0644 |
|
client.py | File | 74.26 KB | 0644 |
|
demo.py | File | 554 B | 0644 |
|
distrib.py | File | 11.45 KB | 0644 |
|
domhelpers.py | File | 8.44 KB | 0644 |
|
error.py | File | 12.49 KB | 0644 |
|
guard.py | File | 630 B | 0644 |
|
html.py | File | 1.52 KB | 0644 |
|
http.py | File | 96.91 KB | 0644 |
|
http_headers.py | File | 8.04 KB | 0644 |
|
iweb.py | File | 24.97 KB | 0644 |
|
microdom.py | File | 35.35 KB | 0644 |
|
proxy.py | File | 9.6 KB | 0644 |
|
resource.py | File | 12.8 KB | 0644 |
|
rewrite.py | File | 1.81 KB | 0644 |
|
script.py | File | 5.61 KB | 0644 |
|
server.py | File | 25.86 KB | 0644 |
|
static.py | File | 35.12 KB | 0644 |
|
sux.py | File | 20.4 KB | 0644 |
|
tap.py | File | 8.73 KB | 0644 |
|
template.py | File | 17.14 KB | 0644 |
|
twcgi.py | File | 11.08 KB | 0644 |
|
util.py | File | 12.12 KB | 0644 |
|
vhost.py | File | 4.36 KB | 0644 |
|
wsgi.py | File | 21.04 KB | 0644 |
|
xmlrpc.py | File | 19.66 KB | 0644 |
|