Newbie and Page Re-Loading

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri May 4 16:48:33 EDT 2007


mosscliffe a écrit :
> Bruno,
> 
> Many thanks for your very helpful reply.
> 
> I am trying WingIDE Personal as an editor, up to now it seems OK.
> 
> My ISP is running Python 2.4.3 and does not know about mod_python.
> 

Few ISPs want to deploy mod_python...

> I do not want to run a framework yet.  I would like to understand
> python at script level, before adding more aspects to learn, like
> frameworks.

Bottom-top approach, hu ?-)

Anyway, "the script level" can be a bit restrictive - you may at least 
want to use modules and functions...

> I think I get your idea about hidden fields and how to alter them.
> 
> My single page script should work something like this
> 
> DisplayHTMLHeaderandBodyHeader
> Check if this is a Re-Load (HiddenField would not exist first time I
> am assuming)
> Display SearchSection with previous SearchRequest

What do you call "previous search request" ?

> If SearchRequest is True: Get and Display Results
> Display TrailerHTMLandTrailerBody

> Does the above make sense or is there a better way ?

This (almost) makes sens in this context. As far as I'm concerned, I'd 
split this in:
- a module handling all search logic
- a module/script/whatever handling all the "display" logic
- a script calling on the first if necessary to get 'raw' search 
results, then calling on the second (with whatever appropriate 
parameters, including stuff like search results) and returning the result.

> How do I get the directory of my modules into the Python Path

import sys
sys.path.append('/path/to/my/modules')

> Is there a lightweight Https Server I could run locally (WINXP), which
> would run .py scripts, without lots of installation modifications ?

http://docs.python.org/lib/module-CGIHTTPServer.html

Don't know what it's worth, and it seems to have a serious limitation 
(no possible redirect), but that may help testing your scripts. FWIW, a 
cgi script can be directly called if you setup the correct environnement 
vars and pass the correct args (which can be done from another script !-)



More information about the Python-list mailing list