Kevin Ballard
kevin at sb.org
Mon Jan 5 07:46:01 EST 2004
Well, that URL isn't valid. I assume you mean something like http://my.domain.com/root/users/files/work1 right? That's not hard. There's a few variations on the solution: 1) If you want it to only work for valid directory trees (i.e. /root/users/files/work1 is valid but /root/foo/bar wouldn't be, assuming /root/foo doesn't exist) then you can use a <Directory> directive. Stick a SetHandler python-program and PythonHandler main in there (assuming the directory with main.py will be in the Python path, i.e. if the main.py is in the directory specified in the <Directory> directive. If it's not there, use the PythonPath directive to tell it where to look). 2) If you want it to work for all paths that match a pattern (say, all paths starting with /root/) then use a <Files> directive and set the same handlers as #1. Same caveats with the python include path. 3) If you want it to apply to every single request to your site, add the handlers from #1 in the root level of your httpd.conf file. Same caveats apply to the include path for main.py (although since this isn't nested, it's just the default Python path so you'll need to add the directory for main.py, such as sys.path+['/foo']) HTH, Kevin On Jan 5, 2004, at 3:47 AM, fowlertrainer at anonym.hu wrote: > I want to this: > > When the user type this path: > http://root/users/files/work1 > then the Apache don't raise an error, only call a py file's procedure > with this path. > > I can take this path, and do anything what I needed. If the path is > wrong, I can show error message, if not, > I can show the result. In the example the path is don't exists, but I > redirect the process to the my UserFileHandler method, > and I do get this user file named "Work1". > > This is just like Access Rule in Zope. > > Can I do that in mod_python ? -- Kevin Ballard kevin at sb.org http://www.tildesoft.com http://kevin.sb.org
|