<s> from django . http import HttpResponse <EOL> from django . utils . encoding import smart_str <EOL> def serve_file ( request , file , save_as , content_type , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> response = HttpResponse ( content_type = content_type ) <EOL> response [ '<STR_LIT>' ] = file . path <EOL> if save_as : <EOL> response [ '<STR_LIT>' ] = smart_str ( u'<STR_LIT>' % save_as ) <EOL> if file . size is not None : <EOL> response [ '<STR_LIT>' ] = file . size <EOL> return response </s>
