6.6 Enabling INCLUDES Filter

SSI is traditionally enabled using the AddOutputFilter directive in the Apache configuration files. Normally this would be where the request mapped to a static file.

AddOutputFilter INCLUDES .shtml

When mod_python is being used, the ability to dynamically enable output filters for the current request can instead be used. This could be done just for where the request maps to a static file, but may just as easily be carried out where the content of a response is generated dynamically. In either case, to enable SSI for the current request, the add_output_filter() method of the mod_python request object would be used.

from mod_python import apache

def fixuphandler(req):
    return apache.OK