File diff 93787dc82072 → 3705a2ba1dac
www/conservancy/static/views.py
Show inline comments
...
 
@@ -33,20 +33,20 @@ def fundgoal_lookup(fundraiser_sought):
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
 
    except FundraisingGoal.DoesNotExist:
 
     # we have no object!  do something
 
        return None
 

	
 
def index(request, *args, **kwargs):
 
    path = request.path
 
    path = request.path.lstrip(u'/')
 
    if path.endswith(u'/'):
 
        path += u'index.html'
 
    try:
 
        path_bytes = path.encode(FILESYSTEM_ENCODING)
 
    except UnicodeEncodeError:
 
        # If the path can't be expressed on the filesystem, it must not exist.
 
        return handler404(request)
 
    if path.endswith(u'/'):
 
        path += u'index.html'
 
    fullpath = os.path.join(STATIC_ROOT, path_bytes)
 
    if not os.path.exists(fullpath):
 
        return handler404(request)
 
    content_type, _ = mimetypes.guess_type(path)
 
    if content_type != 'text/html':
 
        content = open(fullpath)