Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/twisted_8_1/twisted/web/html.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1
2 # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5
6 """I hold HTML generation helpers.
7 """
8
9 from twisted.python import log
10 #t.w imports
11 from twisted.web import resource
12
13 import traceback, string
14
15 from cStringIO import StringIO
16 from microdom import escape
17
18 def PRE(text):
19 "Wrap <pre> tags around some text and HTML-escape it."
20 return "<pre>"+escape(text)+"</pre>"
21
22 def UL(lst):
23 io = StringIO()
24 io.write("<ul>\n")
25 for el in lst:
26 io.write("<li> %s</li>\n" % el)
27 io.write("</ul>")
28 return io.getvalue()
29
30 def linkList(lst):
31 io = StringIO()
32 io.write("<ul>\n")
33 for hr, el in lst:
34 io.write('<li> <a href="%s">%s</a></li>\n' % (hr, el))
35 io.write("</ul>")
36 return io.getvalue()
37
38 def output(func, *args, **kw):
39 """output(func, *args, **kw) -> html string
40 Either return the result of a function (which presumably returns an
41 HTML-legal string) or a sparse HTMLized error message and a message
42 in the server log.
43 """
44 try:
45 return func(*args, **kw)
46 except:
47 log.msg("Error calling %r:" % (func,))
48 log.err()
49 return PRE("An error occurred.")
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/web/guard.py ('k') | third_party/twisted_8_1/twisted/web/http.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698