#5727 closed (duplicate)
views/static.py small refactoring
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Generic views | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If you need to check permissions before allowing access to a static file, you can't use
apache/lighttpd to serve these files.
I changed views/static.py a little, so that you can use HTTP_IF_MODIFIED_SINCE
and mimetype detection for a single file.
Attachments (1)
Change History (6)
by , 18 years ago
| Attachment: | views_static__serve_file.diff added |
|---|
comment:1 by , 18 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:2 by , 18 years ago
| Component: | Uncategorized → Generic views |
|---|
comment:3 by , 18 years ago
views.static.serve() does a lot to the given path:
- uses urllib.unquote()
- split it by /, use os.splitdrive(), redirect if it contains '.' or '..'
- Raise Http404 if it does not exist
I just want to server a filename. It should raise an
Exception, if it does not exist. I wanted to use
the part that checks for 'HTTP_IF_MODIFIED_SINCE', but without
the other stuff.
Feel free to close it, if you don't care. The serve() method
works for me, too.
comment:5 by , 17 years ago
| Cc: | removed |
|---|
I'm not clear on what the point of this patch is. Can you clarify it for me?