[mod_python] URLs

Graham Dumpleton grahamd at dscpl.com.au
Wed Jun 1 18:54:43 EDT 2005


Jim Gallacher wrote ..
> Alexis,
> 
> You'll need to create your own handler.
> 
> Take a look at the first 10 or 20 lines of the handler in 
> mod_python/publisher.py as a guide. It pretty much does what you want.
> 
> To quickly summarize, you'll need to examine req.filename (which will be
> index.py in your case) and req.path_info, which will contain everything
> in the url after index.py, ie. "/this/path/is/not/to/be/processed".
> 
> Strictly speaking, you'll need a url more like:
> http://example.com/index/this/path/is/not/to/be/processed.
> 
> in which case a filename other than index.py will likely make more sense.

Think you might be mixing handler/publisher conventions here. The
inclusion of "index" in the URL is not necessary when defining your own
handler, that is more a property of how mod_python.publisher works.
As long as SetHandler is used instead of AddHandler, then the path:

  http://example.com/this/path/is/not/to/be/processed

should be fine.

Agree that one shouldn't call it index.py, although not for the reason
stated. Problem with calling it index.py is that it is too commonly used
and you end up hitting the known issues in module loader with same
name used in multiple directories.

Again, suggest Vampire as perhaps an alternative example to look at
rather than mod_python.publisher. :-)

Graham

> Alexis Marrero wrote:
> > I want to configure mod_python to not process the URL and just handle
> > the request at the root level.
> > 
> > In other words, a request to:
> > 
> > http://example.com/this/path/is/not/to/be/processed
> > 
> > Needs to be handled by index.py at the root level. And index.py 
> > internally process the rest of the URI 'this/path/is/not/to/be/processed'.
> > 
> > So, my question is how can I configure mod_python for accomplishing this.
> > 
> > Regards,
> > /amn
> > 
> > 
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> > 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python


More information about the Mod_python mailing list