- Subversion (Repository)
- Subversion (Web view)
- Current released version: 0.3.3 ( Python package index entry)
- License: Zope Public License (ZPL) 2.1
- Documentation
- Roadmap
- Changes
What is Ophelia?
Ophelia is a Python package that assembles XHTML pages from templates. It is used on a web server to generate each page at the moment it is requested.
- Ophelia avoids repetitive code.
- Text and HTML structures common to all pages in a directory are stored in a shared common template. What templates a web page consists of and in which way they are combined follows directly from the URL. Thus, it is not even necessary to write for each page which templates it needs to use.
- Ophelia is dynamic.
- Templates are written in TAL, the Template Attribute Language of Zope. TAL is XHTML with the added possibility to acquire the content of DOM elements and attributes from context variables. The context is modified by Python scripts. A template shares a file with its corresponding script to make for easy handling, but there's still a clean separation of Python code from XHTML content.
- Ophelia works on files.
- All templates and scripts reside in the server's file system. Therefore, one can edit and version-control the contents of one's pages easier than using a relational or object database. On the other hand, one would certainly not want to program complex applications in this manner; Ophelia can't be recommended for anything more than «SSI on drugs».
Ophelia is currently used to serve a few web sites, among them this one.
Using Ophelia
After you installed Ophelia and wrote some templates, how can you make it render web pages? Version 0.3 offers three ways of using Ophelia:
- a request handler for mod_python, the Python interface for the Apache web server,
- a WSGI application and a simple HTTP server using it, and
- a script the renders single HTML pages and prints them to its standard output.
The Ophelia documentation entails a small example project which has been installed and is explained at this site.
For a more technical description, see the project's documentation, starting with README.txt.
Package content
The ophelia package consists of an HTTP request handler that
collects templates and scripts and builds web pages from them.
The ophelia.tool package contains some additional tools:
ophelia.tool.navigation- creates a navigation tree and a breadcrumb menu
ophelia.tool.metadata- date and caching functions
