~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/debuginfo/__init__.py

  • Committer: me at id
  • Date: 2009-01-14 22:59:55 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:branches%2Fstorm:1134
apps/debuginfo: Don't use req.user as a dict, and otherwise make it work
    properly. Also cgi.escape some things that need it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
# Important: This application should be removed from a production system.
25
25
 
26
26
import os
 
27
import cgi
27
28
 
28
29
from ivle import util
29
30
import ivle.conf
70
71
        ("user", req.user),
71
72
        ("hostname", req.hostname),
72
73
    ])
73
 
    if req.user is not None:
74
 
        print_table(req, "req.user", dict(req.user).items(), "h4")
75
74
 
76
75
    # Violate encapsulation here to print out the hidden properties
77
76
    print_table(req, "Apache (Hidden) Request Properties", [
88
87
        getfieldvalues(req.get_fieldstorage().items()))
89
88
    session = req.get_session()
90
89
    print_table(req, "Session Variables", session.items())
91
 
    if 'user' in session:
92
 
        print_table(req, "session['user']", dict(session['user']).items(),
93
 
            "h4")
94
90
 
95
91
    print_table(req, "HTTP Request Headers",
96
92
        req.apache_req.headers_in.items())
124
120
    req.write("<%s>%s</%s>\n" % (head_elem, tablename, head_elem))
125
121
    req.write('<table border="1">\n')
126
122
    for (k,v) in mapping:
127
 
        req.write("<tr><th>%s</th><td>%s</td></tr>\n" % (str(k), repr(v)))
 
123
        req.write("<tr><th>%s</th><td>%s</td></tr>\n" %
 
124
                  (cgi.escape(str(k)), cgi.escape(repr(v))))
128
125
    req.write("</table>\n")
129
126