Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#5727 closed (duplicate)

views/ small refactoring

Reported by: Thomas Güttler <hv@…> Owned by: nobody
Component: Generic views Version: master
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


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/ 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@…> 12 years ago.

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by Thomas Güttler <hv@…>

comment:1 Changed 12 years ago by Simon G <dev@…>

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 12 years ago by Jacob

Component: UncategorizedGeneric views

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

comment:3 Changed 12 years ago by Thomas Güttler <hv@…>

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 Changed 11 years ago by Thomas Güttler

Resolution: duplicate
Status: newclosed

duplicate of #6485

comment:5 Changed 11 years ago by Thomas Güttler

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