Castalian: the Active Server Pages object model for Python-embedded HTML pages

Stuart Langridge sil at kryogenix.org
Mon Jul 1 10:31:16 EDT 2002


I've written a thing that provides the Active Server Pages object model to
Python embedded in HTML pages; that way, those of you who think of CGI stuff
in terms of Request.Querystring and Response.Cookies can use Python in pages
on Apache.

The code might look something like:

<html>
<head><title>Hello, world!</title></head>
<body>
Hello, world! (from HTML)<br>
<?cas
response.write("Hello, world! (from Castalian)<br>")

import os
response.write("Your environment variables are:<br>")
for i in os.environ.items():
        response.write("%s=%s<br>\n" % i)

if request.querystring.has_key("foo"):
        response.write("The 'foo' variable in the querystring was:")
        response.write(request.querystring["foo"])
?>
</body>
</html>

I'd be interested in comments; Castalian implements a reasonable
proportion of the ASP object model, and it's been used in some
reasonable-sized projects.

Code available from http://www.kryogenix.org/code/castalian/.

sil

--
2. Make it halfway normal. I don't have any use for
laser-beam-shooting pocket combs, or non-existent existents existing
within their own existences, or ballpoint pens made out of lettuce.
           -- CardinalT dictates rules for the raif Silly Game



More information about the Python-list mailing list