[mod_python] Redirect and/or output regeneration with PSP files

Pavel Roitberg pavel at madman2k.net
Tue May 30 13:41:04 EDT 2006


Anastasios Hatzis (Hatzis Edelstahlbearbeitung) wrote:
> Dear list members,
> 
> I'm still struggling with my PSP files. I like the embedding feature 
> very much, but there is one issue I don't know how to solve and couldn't 
> find a hint in the manual or web. It's about redirecting and/or 
> re-generation of the HTML output depending on object states. I 
> recognized that PSP obviously by default sends header/output directly to 
> the client.
> 
> My first approach: I built a web-layer consisting of PSP-files only. 
> They were called from a browser and each of them imported and accessed 
> appropriate Python modules of my back-end application. These PSP files 
> also included some other PSP files containing HTML snipplets. Structure 
> was simplified like this
> 
> examplePage.psp:
> a) include head.psp
> b) do something with the back-end (imported Python modules with 
> database-access) and build body
> c) include foot.psp
you cant do it that way.
headers must be sent before any other output i.e. before you include 
head.psp.
if you want to redirect using psp look at this example:
<%

# note that the '<' above is the first byte of the page!
psp.redirect('http://www.modpython.org')
%>

http://www.modpython.org/live/current/doc-html/pyapi-psp.html

Pavel


More information about the Mod_python mailing list