[ZPT] ANN: Ophelia 0.3 - Create web sites from TAL templates
Thomas Lotze
thomas at thomas-lotze.de
Fri Jul 6 14:11:02 EDT 2007
Ophelia 0.3 has just been released.
Ophelia creates XHTML pages from templates written in TAL, the Zope Tag
Attribute Language. It is designed to reduce code repetition to zero.
The package contains both a WSGI application running Ophelia as well as a
request handler for mod_python, the Python module for the Apache2 web
server. Additionally, a script is included that renders a page and dumps
it to stdout, and another one that runs a wsgiref based HTTP server
hosting Ophelia's WSGI application.
Ophelia is released under the Zope Public License, version 2.1.
To use Ophelia 0.3, you need Python 2.4. The mod_python request handler
requires mod_python 3.3 or better.
The package is available from the Python package index as a source
distribution and a Python 2.4 egg:
<http://cheeseshop.python.org/pypi/ophelia>
The source code contains a zc.buildout configuration for an environment
including Apache and mod_python.
You can access the source code repository at
<https://svn.thomas-lotze.de/repos/public/Ophelia/>,
browse it using ViewCVS at
<http://svn.thomas-lotze.de/svn-public/Ophelia/>,
or visit Ophelia's web page, containing a commented live usage example, at
<http://www.thomas-lotze.de/en/software/ophelia/>.
>From the documentation:
What kind of sites is Ophelia good for?
=======================================
Static content
--------------
Consider Ophelia as SSI on drugs. It's not fundamentally different, just a
lot friendlier and more capable.
Use Ophelia for sites where you basically write your HTML yourself, except
that you need write the recurring stuff only once. Reducing repetition to zero
comes at a price: your site must follow a pattern for Ophelia to combine your
templates the right way.
Consider your site's layout to be hierarchical: there's a common look to all
your pages, sections have certain characteristics, and each page has unique
content. It's crucial to Ophelia that this hierarchy reflect in the file
system organization of your documents; how templates combine is deduced from
their places in the hierarchy of directories.
Dynamic content
---------------
Ophelia makes the Python language available for including dynamic content.
Each template file may include a Python script. Python scripts and templates
contributing to a page share a common set of variables to modify and use.
Ophelia's content model is very simple and works best if each content object
you publish is its own view: the page it is represented on. If you get content
from external resources anyway (e.g. a database or a version control
repository), it's still OK to use Ophelia even with multiple views per content
object as long as an object's views don't depend on the object's type or even
the object itself.
Trying to use Ophelia on a more complex site will lead to an ugly entanglement
of logic and presentation. Don't use Ophelia for sites that are actually web
interfaces to applications, content management systems and the like.
--
Viele Grüße,
Thomas
More information about the ZPT
mailing list