Issue Details (XML | Word | Printable)

Key: MODPYTHON-103
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Graham Dumpleton
Reporter: Graham Dumpleton
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
mod_python

Implement req.add_output_filter().

Created: 23/Dec/05 09:04 AM   Updated: 02/Apr/07 11:49 AM
Return to search
Component/s: core
Affects Version/s: None
Fix Version/s: 3.3.1

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works grahamd_20060108_1_requestobject.c.diff 2006-01-08 11:09 AM Graham Dumpleton 1 kB
File Licensed for inclusion in ASF works grahamd_20060108_2_multiple.diff 2006-01-08 05:49 PM Graham Dumpleton 11 kB

Resolution Date: 08/May/06 06:15 PM


 Description  « Hide
Add new member function to request object called "add_output_filter()". This would be a wrapper around the function "ap_add_output_filter()" and allow previously defined filters to be attached to the current request such that output can be filtered through them. For example:

  req.add_output_filter("INCLUDES")

It would probably be necessary for any such call to be done prior to the first output being generated from the request handler.

In addition to this member function, it may be necessary to also provide another member function called something like "req.add_python_output_filter()". This would be called something like:

  req.add_python_output_filter("module_name::filter_name",path)

Ie., like "req.add_handler()" but no first argument for phase.

This method would allow a specific Python filter handler function to be specified. This would be equivalent to using the PythonOutputFilter directive to first name a mod_python based filter handler function and then adding it as an output filter.

  # Main Apache config.

  PythonOutputFilter module_name::filter_name MYFILTER

  # Handler code.

  req.add_output_filter("MYFILTER")

Note that the PythonOutputFilter directive can only be used in the main Apache configuration file, it cannot be used in a .htaccess file. Whether it could be made to work in a .htaccess file in some way needs to be investigated. In mod_perl their equivlent seems to allow it.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #380078 Thu Feb 23 09:44:38 UTC 2006 grahamd Added req.register_input_filter(), req.register_output_filter(),
req.add_input_filter() and req.add_output_filter() to support dynamic
registration and chaining of filters to the active request. (MODPYTHON-103)
Files Changed
MODIFY /httpd/mod_python/trunk/test/htdocs/tests.py
MODIFY /httpd/mod_python/trunk/src/include/mod_python.h
MODIFY /httpd/mod_python/trunk/Doc/modpython4.tex
MODIFY /httpd/mod_python/trunk/test/test.py
MODIFY /httpd/mod_python/trunk/src/mod_python.c
MODIFY /httpd/mod_python/trunk/src/requestobject.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h
MODIFY /httpd/mod_python/trunk/src/include/mod_python.h.in

Repository Revision Date User Message
ASF #388487 Fri Mar 24 11:06:08 UTC 2006 grahamd Moved where python_filter() accesses per request Python config to after the
request config object is acquired. Needed as way ap_internal_fast_redirect()
is used by Apache to implement DirectoryIndex was creating scenario where
per request config was null in parent request when accessed, causing a crash.
(MODPYTHON-103) (MODPYTHON-146)
Files Changed
MODIFY /httpd/mod_python/trunk/src/mod_python.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h

Repository Revision Date User Message
ASF #404748 Sun May 07 10:13:50 UTC 2006 grahamd Directory argument supplied to req.add_handler() is canonicalized and a
trailing slash added automatically. This is needed to ensure that the
directory is always in POSIX path style as used by Apache and that
convention where directories associated with directives always have
trailing slash is adhered to. If this is not done, a different interpreter
can be chosen to that expected when the PythonInterpPerDirective is used.
The same sort of modification was also made for the directory argument
of the req.register_input_filter() and req.register_output_filter()
functions. (MODPYTHON-161) (MODPYTHON-103)
Files Changed
MODIFY /httpd/mod_python/trunk/test/htdocs/tests.py
MODIFY /httpd/mod_python/trunk/test/test.py
MODIFY /httpd/mod_python/trunk/src/requestobject.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/Doc/appendixc.tex
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h

Repository Revision Date User Message
ASF #405016 Mon May 08 11:08:32 UTC 2006 grahamd Eliminated crash when dynamically registered filters used in conjunction with
PythonInterpPerDirective. (MODPYTHON-103)
Files Changed
MODIFY /httpd/mod_python/trunk/src/mod_python.c
MODIFY /httpd/mod_python/trunk/lib/python/mod_python/__init__.py
MODIFY /httpd/mod_python/trunk/src/include/mpversion.h

Repository Revision Date User Message
ASF #405290 Tue May 09 03:30:57 UTC 2006 grahamd Old variable definition not removed and was hiding function parameter. If
variable definition attained a non null value, code could also crash. In
worst case, if neither handler or filter specified, result would have been
value of PythonInterpPerDirective setting. The latter shouldn't in practice
occur but cater for it anyway. (MODPYTHON-103)
Files Changed
MODIFY /httpd/mod_python/trunk/src/mod_python.c