Django

Code

Ticket #5727 (closed: duplicate)

Opened 2 years ago

Last modified 10 months ago

views/static.py small refactoring

Reported by: Thomas Güttler <hv@tbz-pariv.de> Assigned to: nobody
Milestone: Component: Generic views
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

views_static__serve_file.diff (0.8 kB) - added by Thomas Güttler <hv@tbz-pariv.de> on 10/10/07 08:53:43.

Change History

10/10/07 08:53:43 changed by Thomas Güttler <hv@tbz-pariv.de>

  • attachment views_static__serve_file.diff added.

12/01/07 20:30:50 changed by Simon G <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

12/02/07 14:52:47 changed by jacob

  • component changed from Uncategorized to Generic views.

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

12/05/07 03:10:02 changed by Thomas Güttler <hv@tbz-pariv.de>

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.

09/04/08 10:12:37 changed by guettli

  • status changed from new to closed.
  • resolution set to duplicate.

duplicate of #6485

09/11/08 01:25:29 changed by guettli

  • cc deleted.

Add/Change #5727 (views/static.py small refactoring)




Change Properties
Action