source: sandbox/filemanager/tp/fckeditor/_samples/py/sampleposteddata.py @ 1575

Revision 1575, 2.0 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3"""
4FCKeditor - The text editor for Internet - http://www.fckeditor.net
5Copyright (C) 2003-2009 Frederico Caldeira Knabben
6
7== BEGIN LICENSE ==
8
9Licensed under the terms of any of the following licenses at your
10choice:
11
12 - GNU General Public License Version 2 or later (the "GPL")
13   http://www.gnu.org/licenses/gpl.html
14
15 - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16   http://www.gnu.org/licenses/lgpl.html
17
18 - Mozilla Public License Version 1.1 or later (the "MPL")
19   http://www.mozilla.org/MPL/MPL-1.1.html
20
21== END LICENSE ==
22
23This page lists the data posted by a form.
24"""
25
26import cgi
27import os
28
29# Tell the browser to render html
30print "Content-Type: text/html"
31print ""
32
33try:
34        # Create a cgi object
35        form = cgi.FieldStorage()
36except Exception, e:
37        print e
38
39# Document header
40print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
41<html>
42        <head>
43                <title>FCKeditor - Samples - Posted Data</title>
44                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
45                <meta name="robots" content="noindex, nofollow">
46                <link href="../sample.css" rel="stylesheet" type="text/css" />
47        </head>
48        <body>
49"""
50
51# This is the real work
52print """
53                <h1>FCKeditor - Samples - Posted Data</h1>
54                This page lists all data posted by the form.
55                <hr>
56                <table border="1" cellspacing="0" id="outputSample">
57                        <colgroup><col width="80"><col></colgroup>
58                        <thead>
59                                <tr>
60                                        <th>Field Name</th>
61                                        <th>Value</th>
62                                </tr>
63                        </thead>
64"""
65for key in form.keys():
66        try:
67                value = form[key].value
68                print """
69                                <tr>
70                                        <th>%s</th>
71                                        <td><pre>%s</pre></td>
72                                </tr>
73                        """ % (cgi.escape(key), cgi.escape(value))
74        except Exception, e:
75                print e
76print "</table>"
77
78# For testing your environments
79#print "<hr>"
80#for key in os.environ.keys():
81#       print "%s: %s<br>" % (key, os.environ.get(key, ""))
82#print "<hr>"
83
84# Document footer
85print """
86        </body>
87</html>
88"""
Note: See TracBrowser for help on using the repository browser.