[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/_samples/py/ -> sampleposteddata.py (source)

   1  #!/usr/bin/env python
   2  
   3  """
   4  FCKeditor - The text editor for Internet - http://www.fckeditor.net
   5  Copyright (C) 2003-2007 Frederico Caldeira Knabben
   6  
   7  == BEGIN LICENSE ==
   8  
   9  Licensed under the terms of any of the following licenses at your
  10  choice:
  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  
  23  File Name: sampleposteddata.py
  24      This page lists the data posted by a form.
  25  
  26  File Authors:
  27          Andrew Liu (andrew@liuholdings.com)
  28  """
  29  
  30  import cgi
  31  import os
  32  
  33  # Tell the browser to render html
  34  print "Content-Type: text/html"
  35  print ""
  36  
  37  try:
  38      # Create a cgi object
  39      form = cgi.FieldStorage()
  40  except Exception, e:
  41      print e
  42  
  43  # Document header
  44  print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  45  <html>
  46      <head>
  47          <title>FCKeditor - Samples - Posted Data</title>
  48          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  49          <meta name="robots" content="noindex, nofollow">
  50          <link href="../sample.css" rel="stylesheet" type="text/css" />
  51      </head>
  52      <body>
  53  """
  54  
  55  # This is the real work 
  56  print """
  57          <h1>FCKeditor - Samples - Posted Data</h1>
  58          This page lists all data posted by the form.
  59          <hr>
  60          <table width="100%" border="1" cellspacing="0" bordercolor="#999999">
  61              <tr style="FONT-WEIGHT: bold; COLOR: #dddddd; BACKGROUND-COLOR: #999999">
  62                  <td nowrap>Field Name&nbsp;&nbsp;</td>
  63                  <td>Value</td>
  64              </tr>
  65  """
  66  for key in form.keys():
  67      try:
  68          value = form[key].value
  69          print """
  70                  <tr>
  71                      <td valign="top" nowrap><b>%s</b></td>
  72                      <td width="100%%">%s</td>
  73                  </tr>
  74              """ % (key, value)
  75      except Exception, e:
  76          print e
  77  print "</table>"
  78  
  79  # For testing your environments
  80  print "<hr>"
  81  for key in os.environ.keys():
  82      print "%s: %s<br>" % (key, os.environ.get(key, ""))
  83  print "<hr>"
  84  
  85  # Document footer
  86  print """
  87      </body>
  88  </html>
  89  """


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7