I should have piped up earlier, but this behavior also occurs with
mod_python. I can't speak for mod_scgi's SCRIPT_NAME and PATH_INFO
behavior, but as of Quixote 2.0 (haven't tried 2.1 yet, though I need to
get rolling on the Fedora Extras packages...) the "abort on an empty
PATH_INFO" behavior essentially means that Quixote will append a
trailing slash onto any directory except the root, leading to situtions
where "http://example.com/one/two/three" redirects with the trailing
slash but "http://example.com/one/two" does not (unless the developer
jumps through some hoops to work around this behavior in the publisher).
I'm not sure what the correct behavior is, but I think consistency is
probably the best policy. Possibly changing Publisher.try_publish to the
following would work:
====================== cut =========================
diff -u publish.py.orig publish.py
--- publish.py.orig 2005-08-11 08:46:13.638524435 -0700
+++ publish.py 2005-08-11 09:04:18.533006111 -0700
@@ -244,11 +244,15 @@
Exceptions are handled by the caller.
"""
self.start_request()
- path = request.get_environ('PATH_INFO', '')
- assert path[:1] == '/'
- # split path into components
- path = path[1:].split('/')
- output = self.root_directory._q_traverse(path)
+ path = request.get_environ('PATH_INFO', '').split('/')
+ # remove the leading slash, if present
+ if not path[0]:
+ path = path[1:]
+ # handle an empty path like Directory._q_traverse would
+ if path:
+ output = self.root_directory._q_traverse(path)
+ else:
+ output = self.root_directory()
# The callable ran OK, commit any changes to the session
self.finish_successful_request()
return output
======================== cut =======================
The above would even stand a chance of working where SCRIPT_NAME is a
directory and PATH_INFO doesn't start with a slash without trying to
guess what PATH_INFO and SCRIPT_NAME should have been.
--
Shahms E. King
Multnomah ESD
Public Key:
http://shahms.mesd.k12.or.us/~sking/shahms.asc
Fingerprint:
1612 054B CE92 8770 F1EA AB1B FEAB 3636 45B2 D75B