[mod_python] Re: PyHTMLArch

Dave Cole djc at object-craft.com.au
Sat Jan 19 15:06:37 EST 2002


> For fun and education, I coded up my own handler. I wanted something
> like a bare-bones HTML::Mason, and I wanted to keep the template and
> the code completely seperate. What I came up with is PyHTMLArch. It
> is now at sourceforge - http://sf.net/projects/pyhtmlarch

You might also want to have a look at the Albatross toolkit (I am the
primary developer).  Albatross is slightly more ambitious in that it
allows you to deploy your application either via mod_python or as a
CGI program.  This is quite handy while you are doing development.

> It has several features that I like.  - The code an the template are
> seperate - The template executes bits of code rather than doing a
> substitute. This is so you can write "The current time is <% time()
> %>" or " <% name %> has phone number of <% phone_nos[name] %>".  -
> The code has full access to the request object. However, the CGI
> parameters are parsed and passed in as arguments.  - It is simple,
> yet powerful. Combined with a working understanding of Apache and
> mod_python, it is quite a useful bit of code.

Albatross uses a DTML like templating syntax with some interesting
capabilities.  latex2html choked on some of the text causing the
template to be truncated, but the PDF documentation shows the template
text correctly.

    http://www.object-craft.com.au/projects/albatross/albatross/tug-tree.html

Macro expansion is a nice way to make your templates maintainable.

    http://www.object-craft.com.au/projects/albatross/albatross/tag-macro.html

There are a number of ways to implement server or client side
sessions.

Albatross is not an application server, it is a toolkit which you can
bend to your particular needs.  Most of the code in the toolkit is a
collection of small classes which are mixed together in different ways
to provide a suite of application frameworks and request execution
contexts.  To get you started quickly there are a number of
pre-packaged classes which are likely to suit your needs.  If these
are not exactly what you require you can provide drop in replacements
for any of the building blocks.

In the following diagram the light grey boxes enclose the pre-packaged
application and execution context classes.  The darker grey boxes
enclose classes which provide the same function but with different
semantics.  By providing your own drop in replacement for any of these
classes you can change one or more aspects of the toolkit behaviour.

    http://www.object-craft.com.au/projects/albatross/albatross/pack-overview.html

The home page for the toolkit is here:

    http://www.object-craft.com.au/projects/albatross/

We use Albatross for paid consulting work, so we are very serious
about making Albatross useful.

The current PDF documentation stands at 125 pages and the current line
count for Albatross (using the highly scientific wc -l metric) is 2646
lines.

- Dave

-- 
http://www.object-craft.com.au




More information about the Mod_python mailing list