Closed: (MODPYTHON-125) Improvements associated with
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Closed: (MODPYTHON-125) Improvements associated with




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Closed: (MODPYTHON-125) Improvements associated with  
Graham Dumpleton (JIRA)


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-05-07 06:13 PM


[ https://issues.apache.org/jira/brow...ls:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-125.
--------------------------------------


> Improvements associated with req.handler for type checker phase.
> ----------------------------------------------------------------
>
>                 Key: MODPYTHON-125
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-125
>             Project: mod_python
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.3
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>             Fix For: 3.3
>
>
> One purpose of the type checker phase in Apache, as able to be hooked using the Py
thonTypeHandler directive, is to use it to make decisions as to which actual handler
 should be used to deliver up the content for a request. It is also intended to be u
sed
to set up attributes such as req.content_type, req.content_encoding and req.
content_languages. An example of an Apache module which supplies a function 
for this phase is mod_mime. That module uses lookups based on content type a
s derived from request URL
extension type, to specify which handler should be used to generate the content. Another is 
mod_negotiation, which performs other sorts of determinations based on the request extension
.
> In mod_python, there are a few missing bits which would allow you to use mod_pytho
n to do the same sorts of things. These are that req.handler, req.content_encoding a
nd req.content_languages are not writable. Of these the most important is probably r
eq.
handler.
> To illustrate how it might be used, imagine an Apache configuration for a 
directory of:
>   PythonTypeHandler select_handler
>   PythonHandler deliver_content
> Although the PythonHandler directive is specified here, it is never actually calle
d. This is because the configuration doesn't specify either "SetHandler" or "AddHand
ler" directives. When the SetHandler directive is used, normally the Apache core wou
ld
see it and trigger mod_python for the content handler phase. If AddHandler is instead used, 
it is mod_mime that would trigger mod_python be used if the extension matches that in the re
quest URL.
> Instead of using either of these directives, what should instead be able t
o be done is that a handler associated with PythonTypeHandler could say that
 mod_python should be triggered for the content phase. This might be done so
mething like:
>   def typehandler(req):
>     if os.path.splitext(req.filename)[1] == ".py":
>       req.handler = "mod_python"
>       return apache.OK
>     return apache.DECLINED
> You might even say exactly which handler should be called as well.
>   def typehandler(req):
>     if os.path.splitext(req.filename)[1] == ".py":
>       req.handler = "mod_python"
>       req.add_handler("PythonHandler","mod_python.publisher")
>       return apache.OK
>     return apache.DECLINED
> Unfortunately, this doesn't work because req.handler isn't writable. With 
req.handler writable it does work and the handler associated with PythonHand
ler, or as specified using req.add_handler() will be executed for the conten
t phase.
> Now the main intent of this JIRA issue is to make req.handler writable, but at the
 same time it is to highlight that for completeness, that req.content_encoding and r
eq.content_languages should also probably be made writable as they are values which 
for
example are modifed by mod_mime in this phase of processing. Note that req.content_type is a
lready writable, which is another attribute which mod_mime modifies in this phase.
>






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:47 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register