Graham Dumpleton
grahamd at dscpl.com.au
Thu Mar 3 16:13:59 EST 2005
Yep, you must be using mod_python 2.7.X as there I get: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/mod_python/apache.py", line 193, in Dispatch result = object(req) File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/site-packages/mod_python/publisher.py", line 89, in handler if func_path[-1] == ".": IndexError: string index out of range BTW, on a quick test of "vampire:publisher" on mod_python 2.7.X, which I hadn't tried before, all four work as expect. Ie., first two are OK, second two 404, or with index function second two yield index. This is one of the benefits of having publisher code which is outside of the main release. It can be made to work the same with both 2.7.X and 3.1.X versions of mod_python and you don't have to suffer the fact that such bugs in 2.7.X will most likely never be fixed. Graham On 04/03/2005, at 8:05 AM, Graham Dumpleton wrote: > Which version of mod_python are you using? > > On mod_python-3.1.4 I get OK, OK, 404, 404. I don't get any mod_python > error > for the last one. > > If I add an index() function, then the last two yield the index() > function > instead as you are expecting. > > On 04/03/2005, at 7:14 AM, 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 >
|