Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#5727 closed (duplicate)

views/static.py small refactoring

Reported by: Thomas Güttler <hv@…> 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)

views_static__serve_file.diff (816 bytes ) - added by Thomas Güttler <hv@…> 17 years ago.

Download all attachments as: .zip

Change History (6)

by Thomas Güttler <hv@…>, 17 years ago

comment:1 by Simon G <dev@…>, 17 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Jacob, 17 years ago

Component: UncategorizedGeneric views

I'm not clear on what the point of this patch is. Can you clarify it for me?

comment:3 by Thomas Güttler <hv@…>, 17 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:4 by Thomas Güttler, 16 years ago

Resolution: duplicate
Status: newclosed

duplicate of #6485

comment:5 by Thomas Güttler, 16 years ago

Cc: hv@… removed
Note: See TracTickets for help on using tickets.
Back to Top