[Tutor] A not-so-basic question...
Patric Michael
patric at usa.net
Mon Jan 3 00:09:55 CET 2005
Hi folks...
I was thinking about this the other day while prepping to write up
another CGI thing.
It occurred to me to wonder how other folks prepare an app, script,
whatever.
So the question is, and I am not looking for a "right answer" here. (I
doubt ther eis one, to be honest.)
How do you go about setting up a new application?
For example, suppose I need a script that will collect order information
for a set of items ona page. Its output will go to a mail program so the
artist can be notified.
I know that the script needs to be somewhat customizable since more
than one person will use it, and I want to look to the future where such a
script might get superceded for something like credit card orders, or
possible integration with a larger order processing scheme.
I'd start out by commenting goals in a new file, like so:
------------------------------
# Initialize variables
# Gather form data
# Output results
--------------------------------------
Then I'd go back through each comment and either call modules I've
prewritten, or write new defs.
Then I'd add import statements to cover the modules and the defs:
----------------------------------
from datetime import now
import cgi
from mailman import send
# Initialize variables
form = cgi.FieldStorage()
# Gather form data
for each in form:
blah
blah
# Output results
result = {}
send(result)
----------------------------------------
And so on.
So the question is, how do you do it?
Is there a method you prefer? Something tried and true, or maybe
foolproof?
Just curious... And maybe a bit hopeful someone has a better way than
mine. Seems like I do an awful lot of testing... :)
Patric
More information about the Tutor
mailing list