mod_python directory index error
Hi, i have a little problem about Directory Index. this is our .htaccess file: Allow from All AddHandler mod_python .py PythonHandler wepy.handler PythonDebug On DirectoryIndex index.htm index.html index.php index.py index.pl wepy is a new PHP like web python library. http://www.wepy.org/ we just type http://blablabla.com/wepy/ and our main file is index.py but req.path_info is None so in mod_python/apache.py/build_cgi_env function: if req.path_info and len(req.path_info) 0: env["SCRIPT_NAME"] = req.uri[:-len(req.path_info)] else: env["SCRIPT_NAME"] = req.uri i think should be like this. if req.path_info: env["SCRIPT_NAME"] = req.uri[:-len(req.path_info)] else: env["SCRIPT_NAME"] = req.uri regards -- Öğr. Gör. Fırat KÜÇÜK Industrial Electronics Program Coordinator --- Department of Industrial Electronics Sakarya University, Adapazari Vocational College + 90 (264) 346 02 32, fkucuk[at]sakarya[dot]edu[dot]tr http://www.adamyo.sakarya.edu.tr/ http://firat.kucuk.org/, firat[at]kucuk[dot]org ---
Re: mod_python directory index error
Firat KUCUK wrote .. Hi, i have a little problem about Directory Index. this is our .htaccess file: Allow from All AddHandler mod_python .py PythonHandlerwepy.handler PythonDebug On DirectoryIndex index.htm index.html index.php index.py index.pl wepy is a new PHP like web python library. http://www.wepy.org/ we just type http://blablabla.com/wepy/ and our main file is index.py but req.path_info is None so in mod_python/apache.py/build_cgi_env function: *if* req.path_info *and* len(req.path_info) 0: env[*SCRIPT_NAME*] = req.uri[:-len(req.path_info)] *else*: env[*SCRIPT_NAME*] = req.uri i think should be like this. if req.path_info: env[SCRIPT_NAME] = req.uri[:-len(req.path_info)] else: env[SCRIPT_NAME] = req.uri What is the actual problem you are trying to solve? The len(req.path_info) 0 is actually redundant because when req.path_info is a string and has length 0, the req.path_info boolean check will fail anyway. In other words, the change you made wouldn't make any difference that I can see to the actual outcome. Is the redundancy all you were wanting to point out??? BTW, you should be careful about what SCRIPT_NAME gets set to by Apache and by this code. See discussion of strange things that happen at: https://issues.apache.org/jira/browse/MODPYTHON-68 Graham
Re: mod_python directory index error
Firat KUCUK wrote: Graham Dumpleton yazmış: Firat KUCUK wrote .. Hi, i have a little problem about Directory Index. this is our .htaccess file: Allow from All AddHandler mod_python .py PythonHandlerwepy.handler PythonDebug On DirectoryIndex index.htm index.html index.php index.py index.pl wepy is a new PHP like web python library. http://www.wepy.org/ we just type http://blablabla.com/wepy/ and our main file is index.py but req.path_info is None so in mod_python/apache.py/build_cgi_env function: *if* req.path_info *and* len(req.path_info) 0: env[*SCRIPT_NAME*] = req.uri[:-len(req.path_info)] *else*: env[*SCRIPT_NAME*] = req.uri i think should be like this. if req.path_info: env[SCRIPT_NAME] = req.uri[:-len(req.path_info)] else: env[SCRIPT_NAME] = req.uri What is the actual problem you are trying to solve? The len(req.path_info) 0 is actually redundant because when req.path_info is a string and has length 0, the req.path_info boolean check will fail anyway. In other words, the change you made wouldn't make any difference that I can see to the actual outcome. Is the redundancy all you were wanting to point out??? BTW, you should be careful about what SCRIPT_NAME gets set to by Apache and by this code. See discussion of strange things that happen at: https://issues.apache.org/jira/browse/MODPYTHON-68 Graham briefly: print len(None) TypeError: len() of unsized object if we use: if req.path_info *and* len(req.path_info) 0: the same error will be occur. Not in my python it doesn't. Python 2.3.5 (#2, Nov 20 2005, 16:40:39) [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 Type help, copyright, credits or license for more information. a = None if a and len(a) 0: ... print True ... else: ... print False ... False Perhaps you could show us the full traceback? Jim