Back to index

python-weblib  1.3.9
Functions | Variables
test-forms Namespace Reference

Functions

def ErrorExit
def PrintEmptyInputForm
def PrintInputData

Variables

tuple form = forms.Form(sys.stdin,os.environ)
int size = 25
int show = 1
list options = [('value1','Option 1'),'value2',('value3','Option 3')]
list default = ['value2','value3']
int rows = 5

Function Documentation

def test-forms.ErrorExit (   Msg)

Definition at line 12 of file test-forms.py.

00012 
00013 def ErrorExit(Msg):
00014   print """Content-type: text/html
00015 
00016 <html>
00017   <title>
00018     Error
00019   </title>
00020   <body>
00021     <h1>Error</h1>
00022     <p>%s</p>
00023   </body>
00024 </html>
00025 """ % Msg

def test-forms.PrintEmptyInputForm (   form,
  Msg = '' 
)

Definition at line 26 of file test-forms.py.

00026 
00027 def PrintEmptyInputForm(form,Msg=''):
00028   print """Content-type: text/html
00029 
00030 <html>
00031   <title>
00032     Give me some data!
00033   </title>
00034   <body>
00035     <h1>Give me some data!</h1>
00036     <form
00037       method="POST"
00038       enctype="multipart/form-data"
00039       action="%s"
00040     >
00041       <table border>
00042 """ % (os.environ['SCRIPT_NAME'])
00043   for name in form.declaredFieldNames:
00044     f = form.field[name]
00045     print '<TR><TD>%s%s</TD><TD>%s</TD></TR>' % (
00046       f.labelHTML(),f.required*'<BR>required',f.inputHTML()
00047     )
00048   print """      </table>
00049       <input type="submit" value="Send">
00050     </form>
00051   </body>
00052 </html>
00053 """

def test-forms.PrintInputData (   form)

Definition at line 54 of file test-forms.py.

00054 
00055 def PrintInputData(form):
00056   # Anzeige der eingegebenen Daten
00057   print """Content-type: text/html
00058 
00059 <html>
00060   <title>
00061     Your input data
00062   </title>
00063   <body>
00064     <h1>Your input data</h1>
00065     <table border>
00066 """
00067   for i in form.inputFieldNames:
00068     contentlist = []
00069     f = form.field[i]
00070     if f.value != None:
00071       if type(f.value) is types.ListType:
00072         contentlist.extend(f.valueHTML())
00073       else:
00074         contentlist.append(f.valueHTML())
00075     else:
00076       contentlist.append('&nbsp;')
00077     print '<tr><td>%s</td><td>%s</td></tr>' % (i,'<br>'.join(contentlist))
00078   print """
00079     </table>
00080   </body>
00081 </html>
00082 """


Variable Documentation

list test-forms.default = ['value2','value3']

Definition at line 105 of file test-forms.py.

tuple test-forms.form = forms.Form(sys.stdin,os.environ)

Definition at line 83 of file test-forms.py.

list test-forms.options = [('value1','Option 1'),'value2',('value3','Option 3')]

Definition at line 104 of file test-forms.py.

int test-forms.rows = 5

Definition at line 119 of file test-forms.py.

int test-forms.show = 1

Definition at line 93 of file test-forms.py.

int test-forms.size = 25

Definition at line 87 of file test-forms.py.