Ticket #5727: views_static__serve_file.diff

File views_static__serve_file.diff, 816 bytes (added by Thomas Güttler <hv@…>, 17 years ago)
  • django/views/static.py

     
    4646        raise Http404, "Directory indexes are not allowed here."
    4747    if not os.path.exists(fullpath):
    4848        raise Http404, '"%s" does not exist' % fullpath
     49    return serve_file(request, fullpath)
     50
     51def serve_file(request, fullpath):
     52    """
     53    If you don't want to server static files with apache/lighttpd,
     54    you can use this method.
     55    One reason might be, that you need to check permissions before you allow
     56    access to this file.
     57    """
    4958    # Respect the If-Modified-Since header.
    5059    statobj = os.stat(fullpath)
    5160    if not was_modified_since(request.META.get('HTTP_IF_MODIFIED_SINCE'),
Back to Top