[mod_python] FW: Any way to embed Python in HTML?

Stephen Vermeulen stephen at vermeulen.ca
Mon Dec 22 19:41:15 EST 2003

Jalil Feghhi wrote:

> I am new to mod_python and haven't seen any examples where you can put 
> python code in HTML pages. Is this not supported?

While working with mod_python 3.03 I did something along these lines, 
which I consider to be a rather
evil hack (this was done on some "for internal use only" pages). I used 
python's pickle module to serialize up some
objects, then base64 encoded them into ASCII form, and then placed the 
resulting text into hidden form fields
on the page that was served up. This allowed me to pass some complex 
state information (that was expensive to
generate, and was also generated by a different program at an earlier 
time) relating to the page that the user
was editing into the mod_python code that did the editing.

> If not supported, is there any way or work around (other than using 
> the request write method) to separate HTML writing from coding?
> Thanks,
> -Jalil



More information about the Mod_python mailing list