[mod_python] options to suppress error when accessing module directly with Publisher

Nick nick at dd.revealed.net
Thu Mar 3 15:33:26 EST 2005


Hate to sound like a broken record, but I usually resolve these sorts of 
issues with mod_rewrite.

Nick

Jorey Bump wrote:
> I'm replacing a directory of files with a single module for use with 
> Publisher. As this location is used by a new set of users each cycle, I 
> won't need to account for any old links. However, it's likely that some 
> users will try backing up from the function to the module name itself, 
> which will return a mod_python error (I have debug on). Is there any way 
> to handle this error in another way?
> 
> For example, given a module foo.py with a function bar, this is the link 
> we will be distributing to users:
> 
>  http://example.com/foo/bar
> 
> This also works:
> 
>  http://example.com/foo/bar/
> 
> And this returns a 404 Not Found error, which is fine:
> 
>  http://example.com/foo
> 
> But adding a slash returns a mod_python error:
> 
>  http://example.com/foo/
> 
> This is the kind of thing that users will try to do to search for 
> information. It's usually nonmalicious, and some browsers even provide 
> convenient widgets to backtrack over an URL. I'd rather return a 404 
> than an interpreter error. Any thoughts?
> 
> It's interesting that naming a module index.py can hide the module name 
> in an URL. Why not do the opposite, and allow a function named index in 
> a module to be the default location if the module is called directly, 
> with a trailing slash?
> _______________________________________________
> 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