]> git.parisson.com Git - telemeta.git/commitdiff
cleanup
authoryomguy <yomguy@parisson.com>
Mon, 12 Nov 2012 07:39:57 +0000 (08:39 +0100)
committeryomguy <yomguy@parisson.com>
Mon, 12 Nov 2012 07:39:57 +0000 (08:39 +0100)
telemeta/views/core.py
telemeta/views/home.py
telemeta/views/instrument.py
telemeta/views/item.py

index e3a7b7454e77c4c4e4811f2aa45423794c8937df..f57f35e09e3ac27506ef826a7dc1ab1c2c44a9d9 100644 (file)
@@ -91,7 +91,7 @@ class FixedFileWrapper(FileWrapper):
         self.filelike.seek(0)
         return self
 
-def send_file(request, filename, content_type='image/jpeg'):
+def send_file(request, filename, content_type=None):
     """
     Send a file through Django without loading the whole file into
     memory at once. The FileWrapper will turn the file object into an
@@ -102,6 +102,16 @@ def send_file(request, filename, content_type='image/jpeg'):
     response['Content-Length'] = os.path.getsize(filename)
     return response
 
+def nginx_media_accel(request, filename):
+    """Send a protected medie file through nginx with X-Accel-Redirect"""
+
+    response = HttpResponse()
+    url = settings.MEDIA_URL + filename
+    # let nginx determine the correct content type 
+    response['Content-Type'] = ""     
+    response['X-Accel-Redirect'] = url
+    return response
+
 def render(request, template, data = None, mimetype = None):
     return render_to_response(template, data, context_instance=RequestContext(request),
                               mimetype=mimetype)
index ec768ac5b15725d56f33054f73c8140a94918143..411193d58d6b0e8221a13dc9f829baa2cf597a2b 100644 (file)
@@ -37,6 +37,7 @@
 
 from telemeta.views.core import *
 
+
 class HomeView(object):
     """Provide general web UI methods"""
 
@@ -72,7 +73,7 @@ class HomeView(object):
         return HttpResponse(template.render(context))
 
     def lists(self, request):
-        """Render the home page"""
+        """Render the list page"""
 
         if request.user.is_authenticated():
             template='telemeta/lists.html'
index 934c4de3602d340b70a21e301169889cd46a0096..023aa8aacc951d7bfff022ed1191170dd28c2d1c 100644 (file)
@@ -37,6 +37,7 @@
 
 from telemeta.views.core import *
 
+
 class InstrumentView(object):
     """Provide Instrument web UI methods"""
 
index 9bf2da26770390cc876b5f6981227ae61ee1144b..018d3a24d05399694e4da7ca3334ecb810ab7784 100644 (file)
@@ -37,6 +37,7 @@
 import mimetypes
 from telemeta.views.core import *
 
+
 class ItemView(object):
     """Provide Collections web UI methods"""