You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by nl...@apache.org on 2005/04/30 09:29:35 UTC
svn commit: r165390 -
/httpd/mod_python/trunk/lib/python/mod_python/publisher.py
Author: nlehuen
Date: Sat Apr 30 00:29:32 2005
New Revision: 165390
URL: http://svn.apache.org/viewcvs?rev=165390&view=rev
Log:
Fix for MODPYTHON-49.
Modified:
httpd/mod_python/trunk/lib/python/mod_python/publisher.py
Modified: httpd/mod_python/trunk/lib/python/mod_python/publisher.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/lib/python/mod_python/publisher.py?rev=165390&r1=165389&r2=165390&view=diff
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/publisher.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/publisher.py Sat Apr 30 00:29:32 2005
@@ -93,6 +93,7 @@
# if not, we look for index.py
req.filename = os.path.join(path,'index.py')
+ # Now we build the function path
if not req.path_info or req.path_info=='/':
# we don't have a path info, or it's just a slash,
@@ -106,19 +107,38 @@
else:
- # The file does not exist, so it seems we are in the
- # case of a request in the form :
- # /directory/func_path
+ # First we check if there is a Python module with that name
+ # just by adding a .py extension
+ if os.path.isfile(req.filename+'.py'):
- # we'll just insert the module name index.py in the middle
- path, func_path = os.path.split(req.filename)
- req.filename = os.path.join(path,'index.py')
+ req.filename += '.py'
+
+ # Now we build the function path
+ if not req.path_info or req.path_info=='/':
+
+ # we don't have a path info, or it's just a slash,
+ # so we'll call index
+ func_path = 'index'
+
+ else:
+
+ # we have a path_info, so we use it, removing the first slash
+ func_path = req.path_info[1:]
+ else:
- # I don't know if it's still possible to have a path_info
- # but if we have one, we append it to the filename which
- # is considered as a path_info.
- if req.path_info:
- func_path = func_path + req.path_info
+ # The file does not exist, so it seems we are in the
+ # case of a request in the form :
+ # /directory/func_path
+
+ # we'll just insert the module name index.py in the middle
+ path, func_path = os.path.split(req.filename)
+ req.filename = os.path.join(path,'index.py')
+
+ # I don't know if it's still possible to have a path_info
+ # but if we have one, we append it to the filename which
+ # is considered as a path_info.
+ if req.path_info:
+ func_path = func_path + req.path_info
# Now we turn slashes into dots
func_path = func_path.replace('/','.')