This includes patch for adding SSI support for Python.
Note that line numbers will probably not match subversion head at this time as I have a lot of other code changes in my local mod_python version. Thus, have generated context diffs, and you will need to look out at how code fits into surrounding code.
What the patch implements is the ability to do stuff like the following in files for which the builtin "INCLUDES" output filter of Apache is enabled. Typically this is for .shtml files but it can be enabled explicitly for other files as well.
from mod_python import apache
parts = apache.import_module('parts')
print >> filter
for key in filter.req.subprocess_env:
print >> filter, _escape((key, filter.req.subprocess_env[key]))
One can use either "eval" or "exec". If using "exec", Python code can't have leading indent for first line. Ie., code must be left justified, with indents only used for blocks of code where appropriate. Variables created or modules imported in any code section are accessible to later code sections in that page. Ie., globals/locals are preserved across code sections.
Note that the changes don't do anything special as far as escaping content which may be included in sections of HTML, or in URLs or as values to attributes of HTML elements. It is expected that user do this appropriate for context.
Note also that nothing special is done about Unicode strings. One might consider doing what mod_python.publisher does in 3.2.6 for Unicode strings, but that can only be done for result of an "eval".
In line with how CGI "exec" and mod_perl work, Python code will not be run if "IncludesNOEXEC" option is set.