Minor fixes required by new authz logic.

* lib/viewvc.py
  (_strip_suffix): If no path_parts are provided, return None.
  (Request.run_viewvc): Tweak the 404 error to, among other things,
    always have a leading slash on the path (so the empty path doesn't
    look so odd).


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1799 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/log-paging
cmpilato 2008-02-15 20:50:22 +00:00
parent 5a238e6a56
commit 08e86c9a45
1 changed files with 4 additions and 2 deletions

View File

@ -290,8 +290,8 @@ class Request:
self.where = _path_join(self.path_parts)
needs_redirect = 1
else:
raise debug.ViewVCException('%s: unknown location'
% self.where, '404 Not Found')
raise debug.ViewVCException("Unknown location: /%s" % self.where,
"404 Not Found")
# If we have an old ViewCVS Attic URL which is still valid, redirect
if self.roottype == 'cvs':
@ -683,6 +683,8 @@ def _path_join(path_parts):
def _strip_suffix(suffix, path_parts, rev, pathtype, repos, view_func):
"""strip the suffix from a repository path if the resulting path
is of the specified type, otherwise return None"""
if not path_parts:
return None
l = len(suffix)
if path_parts[-1][-l:] == suffix:
path_parts = path_parts[:]