[Abstract] [Introduction] [Methods] [Discussion] [References]
Figure 1.
The class "web" - an example of the use of some of it's methods.
1. The class instance is invoked. 2. Initialization of an HTML document. 3. Anchoring of a URL. 4. Providing an image. The ALT and ALIGN fields have defaults that can be altered. 5. Initialization of a form. The method defaults to POST and may be altered to GET by the invokation. 6. Instant invokation of a submit button. 7. Creating a line input of a form with a default text. 8. Creating an options selection list with a pre-defined selection.

Written by Benny shomer, The EBI.

bshomer@ebi.ac.uk


1. >>> from WWW import web >>> w = web() 2. >>> w.initialize('This is a test document') Content-type: text/html <HEADER> <TITLE>This is a test document</TITLE> </HEADER> <BODY> 3. >>> print w.anchor('http://www.ebi.ac.uk/','The EBI home page') <A HREF="http://www.ebi.ac.uk/">The EBI home page</A> 4. >>> print w.fig('../icons/spam.gif') <IMG SRC="../icons/spam.gif" ALT="IMAGE" ALIGN="MIDDLE"> 5. >>> w.form('http://www.ebi.ac.uk/htbin/embl_subs.py') <FORM METHOD="POST" ACTION="http://www.ebi.ac.uk/htbin/embl_subs.py"> 6. >>> w.button_submit() <INPUT TYPE="submit" VALUE="Submit"> 7. >>> print w.lineinp('ADDRESS',40,'My default address.') <INPUT TYPE= "TEXT" NAME= "ADDRESS" SIZE= "40" MAXLENGTH= "20" VALUE= "My default address."> 8. >>> mylist=['hats','socks','shirts','pants','jackets','ties'] >>> print w.option('clothing',mylist,3) <SELECT NAME = "clothing"> <OPTION> hats <OPTION> socks <OPTION> shirts <OPTION SELECTED > pants <OPTION> jackets <OPTION> ties </SELECT>