From 431acd0a6e9d98d370eb49ff83deb2d795290c31 Mon Sep 17 00:00:00 2001 From: ianb Date: Tue, 13 Dec 2005 22:30:42 +0000 Subject: Be a little less picky about 'ambiguous' filenames in URLParser, when one of the filename matches is an exact match --- paste/urlparser.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'paste/urlparser.py') diff --git a/paste/urlparser.py b/paste/urlparser.py index 0e6efac..47e89aa 100644 --- a/paste/urlparser.py +++ b/paste/urlparser.py @@ -239,10 +239,16 @@ class URLParser(object): # % (base_filename, self.directory)) return None if len(possible) > 1: - environ['wsgi.errors'].write( - 'Ambiguous URL: %s; matches files %s\n' - % (wsgilib.construct_url(environ), - ', '.join(possible))) + # If there is an exact match, this isn't 'ambiguous' + # per se; it might mean foo.gif and foo.gif.back for + # instance + if full_filename in possible: + return full_filename + else: + environ['wsgi.errors'].write( + 'Ambiguous URL: %s; matches files %s\n' + % (wsgilib.construct_url(environ), + ', '.join(possible))) return None return possible[0] -- cgit v1.2.1