Added 3rd party sendfile app

This commit is contained in:
Roberto Rosario
2011-03-24 16:40:12 -04:00
parent 8f82c82825
commit 278d8bcf10
7 changed files with 123 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
from django.http import HttpResponse
from django.core.files.uploadedfile import SimpleUploadedFile
def sendfile(request, filename):
return = HttpResponse(IterFile(filename))
class IterFile(object):
def __init__(self, filename):
self.file = SimpleUploadedFile(name=filename, content=open(filename).read())
def __iter__(self):
return self.file.chunks()