Author: ccahoon
Date: 2009-07-17 06:47:54 -0500 (Fri, 17 Jul 2009)
New Revision: 11261

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/http/__init__.py
Log:
[soc2009/http-wsgi-improvements] Fix HttpResponseSendFile indentation issue and 
set its initial content to be an empty string, for compatibility with ticket 
refs #6527.

Modified: django/branches/soc2009/http-wsgi-improvements/django/http/__init__.py
===================================================================
--- django/branches/soc2009/http-wsgi-improvements/django/http/__init__.py      
2009-07-17 11:33:35 UTC (rev 11260)
+++ django/branches/soc2009/http-wsgi-improvements/django/http/__init__.py      
2009-07-17 11:47:54 UTC (rev 11261)
@@ -442,19 +442,18 @@
     sendfile_fh = None
 
     def __init__(self, path_to_file, content_type=None, block_size=8192): 
-           if not content_type: 
-               from mimetypes import guess_type 
-               content_type = guess_type(path_to_file)[0] 
-               if content_type is None: 
-                   content_type = "application/octet-stream" 
-           super(HttpResponseSendFile, self).__init__(None, 
-                   content_type=content_type) 
-           self.sendfile_filename = path_to_file 
-           self.block_size = block_size 
-           self['Content-Length'] = os.path.getsize(path_to_file) 
-           self['Content-Disposition'] = ('attachment; filename=%s' % 
-                   os.path.basename(path_to_file)) 
-           self[settings.HTTPRESPONSE_SENDFILE_HEADER] = path_to_file 
+        if not content_type:
+            from mimetypes import guess_type
+            content_type = guess_type(path_to_file)[0]
+            if content_type is None:
+                content_type = "application/octet-stream"
+        super(HttpResponseSendFile, self).__init__('', 
content_type=content_type)
+        self.sendfile_filename = path_to_file
+        self.block_size = block_size
+        self['Content-Length'] = os.path.getsize(path_to_file)
+        self['Content-Disposition'] = ('attachment; filename=%s' %
+             os.path.basename(path_to_file))
+        self[settings.HTTPRESPONSE_SENDFILE_HEADER] = path_to_file
 
     def __iter__(self):
         from django.core.servers.basehttp import FileWrapper


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to