Python Servlet Engine

"So simple and elegant, yet extremely powerful."
- PSE User

PSE Compared to PHP

PHP users can make the transition to Python much more quickly and easily using PSE rather than straight mod_python and other templating tools. This is because PSE can use an embedded model like PHP does, while still leaving you with the ability to move to a servlet model.

This example was taken from an example described in the article "User-Friendly Form Validation with PHP and CSS" by Jeff Cogswell, published at ONLamp.com on 04/22/2004. Some changes were made to fix obvious errors in the sample code provided in the article.

Here is the original PHP code, translated directly to PSE:

email.php
The original PHP code from the article.
email.pt
A direct translation of the PHP to a PSE template.

Alternatively, here is how one might separate the HTML and Python code using PSE's model:

alt_email.pt
An alternate implementation providing only the template portion.
alt_email.py
The accompanying logic portion for the alternate implementation.

Back to PSE Examples


Copyright ©2003-2005 by Nicholas Borko. All Rights Reserved.