[mod_python] URLs

Jim Gallacher jg.lists at sympatico.ca
Wed Jun 1 19:27:16 EDT 2005


Graham Dumpleton wrote:
> 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. 

Entirely possible! :)

> 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.

I guess my use case is a little different, unusual and probably wrong. 
In my www/ heirarchy index.py  (or whatever.py) is just a stub that 
causes the real code to be loaded. I'm trying to do a RESTful kind of 
thing, and yes I'd probably be better off using Vampire...

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

...and one day I'll take a look at it. I really, really mean it. :)

> 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
> 
> _______________________________________________
> 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