Website Programming Applications IV (Python) Information
Module Documents
Module Guide
Assignment 1
Assignment 2
CGI Demonstrations
WPA4 Mailing List Manager
LETS trading simulation game.
Downloads
cgiutils1.py source code for the CGI Utilities Module version 1.
Python and HTML source code
for WPA4 list management CGI demonstration programs.
ballbox.py and
balls.py source codes for dropping balls class demo.
Calling python code and
compiled python code module
for bouncing balls class demo.
Course Notes and Tutorial/Lab excercises
Week 1 Notes
- 1.1 What is Python ?
- 1.2 Python books and Internet resources
- 1.3 Python as a programming language
- 1.4 Simple Python program examples
- 1.5 Creating and running a Python program
- 1.6 Some number operations
- 1.7 Some text-string operations
Week 1 Tutorial exercises
Week 2 Notes
- 2.1 Getting user input from the keyboard
- 2.2 if, elif, and else program branches
- 2.3 Comparing numbers and strings
- 2.4 Combining tests with 'not','and' and 'or'
- 2.5 Accessing files on disk
- 2.6 File opening
- 2.7 File output
- 2.8 Input from files
- 2.9 Closing files
Week 2 Tutorial exercises
Week 3 Notes
- 3.1 Tuples or lists you can't change
- 3.2 Lists you can change
- 3.3 Strings as immutable lists of characters
- 3.4 List and string slices
- 3.5 Generating sequences using range()
- 3.6 for loops
- 3.7 while loops
- 3.8 using a loop to build a list
- 3.9 breaking out of a loop early
Week 3 Tutorial exercises
Week 4 Notes
- 4.1 Mastering the horrible exploding bug swarm
- 4.2 A simple function example
- 4.3 Identifying functions during program design
- 4.4 Sending objects to functions using parameters
- 4.5 Returning objects from functions
- 4.6 Local, global and built-in object name scope
- 4.7 Modules for filing functions and data neatly
- 4.8 Modules, importing and use of names
- 4.9 Using Python's built in modules
- 4.10 The PYTHONPATH environment variable
Week 4 Tutorial exercises
Week 5 Notes
- 5.1 Dictionary basics
- 5.2 Compound keys and values
- 5.3 Lists of Dictionaries
- 5.4 Other data structures
- 5.5 Saving and loading complex objects using pickle
- 5.6 Using the string module
- 5.7 Introduction to Regular Expressions
- 5.8 Common Patterns and REs to match them
- 5.9 Using a RE in a Python program
- 5.10 Getting text before, on and after the match
- 5.11 Substituting matched text
Week 5 Tutorial exercises
Week 6 Notes
- 6.1 Why classes and objects ?
- 6.2 Using a trivial class and made up attributes
- 6.3 Methods
- 6.4 Constructor methods
- 6.5 Class data attributes
- 6.6 Inheritance
- 6.7 Polymorphism
- 6.8 Controlling access to class and object attributes
Week 6 Tutorial exercises
Week 7 Notes
- 7.1 Error Handling
- 7.2 Trapping an error
- 7.3 The catchall approach
- 7.4 Raising your own exceptions
- 7.5 Forcing cleanup with try - finally
- 7.6 Defining your own error
- 7.7 Using command line parameters in Python
- 7.8 Use of the glob module for file wildcarding
- 7.9 Use of the os, stat and time modules
Week 7 Tutorial exercises
Week 8 Notes
- 8.1 Introduction to the CGI environment
- 8.2 Outputting variable data using HTML
- 8.3 Passing parameters to a CGI program using the URL
- 8.4 Using a HTML Form
- 8.5 Getting a Python program to send a mail message
- 8.6 Precautions needed when automating mail
- 8.7 Automatic mail response to HTML Form input
Week 8 Tutorial exercises
Week 9 Notes
- 9.1 Validating CGI form and URL input
- 9.2 Validation functions
- 9.3 Packaging some useful CGI and mail functions
- 9.4 Ending the HTML
- 9.5 Maintaining session state
- 9.6 Use of cookies in maintaining state
- 9.7 Use of data stored on the server for maintaining state
- 9.8 Use of hidden form fields to authenticate users and track session
- 9.9 Creating a session key or PIN
- 9.10 Debugging cgiutils.py module code
- 9.11 Further developing the cgiutils module
Week 9 Tutorial exercises
Week 10 Notes
- 10.1 Extending cgiutils2.py to handle inputs
- 10.2 A PIN generating function
- 10.3 Handling multiple values for the same key
- 10.4 Handling float and int values
- 10.5 Testing the extended cgiutils2 module
- 10.6 Debugging techniques for CGI programs
Week 10 Tutorial exercises
Week 11 Notes
- 11.1 CGI data storage
- 11.2 Designing a database table class for CGI use
- 11.3 CGI table class methods
- 11.4 CGI table class data
- 11.5 CGI table class source code
- 11.6 Testing and debugging the table class
- 11.7 CGI program concurrency and file storage
- 11.8 The Mailman LockFile.py module
Week 11 Tutorial exercises
Week 12 Notes
- 12.1 Purpose of the WPA4 list management system
- 12.2 Use of CGI programs and Python modules
- 12.3 Database tables and the table_details.py module
- 12.4 entry.form
- 12.5 entry.cgi
- 12.6 add.form
- 12.7 add.cgi
- 12.8 post.form
- 12.9 post.cgi
Week 12 Tutorial exercises