Commented: (MODPYTHON-46) PythonHandlerModule directive is broken.
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 > Commented: (MODPYTHON-46) PythonHandlerModule directive is broken.




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

    Commented: (MODPYTHON-46) PythonHandlerModule directive is broken.  
Graham Dumpleton (JIRA)


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


 
04-10-05 07:45 AM

[ http://issues.apache.org/jira/brows...n_62519
 ]

Graham Dumpleton commented on MODPYTHON-46:
-------------------------------------------

Conversely, if you define:

PythonHandler xxx::yyy

and "yyy" doesn't exist in the module "xxx", it doesn't complain when
it really should.

> PythonHandlerModule directive is broken.
> ----------------------------------------
>
>          Key: MODPYTHON-46
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-46
>      Project: mod_python
>         Type: Bug
>   Components: core
>     Versions: 3.1.4
>     Reporter: Graham Dumpleton

>
> Documentation for PythonHandlerModule says:
>   PythonHandlerModule can be used an alternative to Python*Handler directi
ves.
>   The module specified in this handler will be searched for existence of f
unctions
>   matching the default handler function names, and if a function is found,
 it will
>   be executed.
> The suggestion is that it will not complain if a particular handler is def
ined, ie.,
> only executes the ones it finds and doesn't worry about the rest. The exam
ple
> even supports this by saying that:
>   For example, instead of:
>     PythonAutenHandler mymodule
>     PythonHandler mymodule
>     PythonLogHandler mymodule
>   one can simply say
>     PythonHandlerModule mymodule
> BTW, "PythonAutenHandler" is spelt wrong in documentation, not by me.
> The "mod_python.c" code also seems be coded so that if a handler is define
d
> in the module that it will not complain.
>     python_directive_handler(cmd, mconfig, "PythonPostReadRequestHandler",
 val, SILENT);
>     python_directive_handler(cmd, mconfig, "PythonTransHandler", val, SILE
NT);
>     python_directive_handler(cmd, mconfig, "PythonHeaderParserHandler", va
l, SILENT);
>     python_directive_handler(cmd, mconfig, "PythonAccessHandler", val, SIL
ENT);
>     python_directive_handler(cmd, mconfig, "PythonAuthzHandler", val, SILE
NT);
>     python_directive_handler(cmd, mconfig, "PythonTypeHandler", val, SILEN
T);
>     python_directive_handler(cmd, mconfig, "PythonHandler", val, SILENT);
>     python_directive_handler(cmd, mconfig, "PythonInitHandler", val, SILEN
T);
>     python_directive_handler(cmd, mconfig, "PythonLogHandler", val, SILENT
);
>     python_directive_handler(cmd, mconfig, "PythonCleanupHandler", val, SI
LENT);
>     python_directive_handler(cmd, srv_conf, "PythonConnectionHandler", val
, SILENT);
> Ie., it has "SILENT" option and not "NOTSILENT" as is case when single han
dler is
> specified.
> Problem is that using "PythonHandlerModule" it gives back 500 error and if
> "PythonDebug" is on you will see in the browser:
>   Mod_python error: "PythonHeaderParserHandler mptest"
>   Traceback (most recent call last):
>     File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 291
, in HandlerDispatch
>       arg=req, silent=hlist.silent)
>     File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 519
, in resolve_object
>       raise AttributeError, s
>   AttributeError: module '/home/grahamd/public_html/phases/mptest.py' cont
ains no 'headerparserhandler'
> The passing of "SILENT" thus seems to not work.
> The definitions of SILENT and NOTSILENT are:
>   #define SILENT 0
>   #define NOTSILENT 1
> This eventually gets set as hlist.silent and gets passed as "silent" argum
ent of
> the "resolve_object()" method.
> In the resolve_object() call of apache.py where this is checked, it is che
cked as:
>         # don't throw attribute errors when silent
>         if silent and not hasattr(obj, obj_str):
>             return None
>         # this adds a little clarity if we have an attriute error
>         if obj == module and not hasattr(module, obj_str):
>             if hasattr(module, "__file__"):
>                 s = "module '%s' contains no '%s'" % (module.__file__, obj
_str)
>                 raise AttributeError, s
> Is the logic the wrong way around here or am I just going nuts?
> The result of "resolve_object()" is used as:
>                 if object:
>                     ...
>                 elif hlist.silent:
>                     result = DECLINED
> This is supposed to propogate ignoring of the fact that the handler is mis
sing,
> but again logic is wrong way.
> The simple solution may be:
>   #define NOTSILENT 0
>   #define SILENT 1
> All uses of this silent flag needs to be reviewed though to determine if t
his is
> going to stuff up other areas of the code.






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:32 PM.      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