return Response(body, content_type=mimetype)
Here "body" is an buffer object from a kind of filesystem which represents the content in the file. Since, it doesn't support len() like String. I can't passed the Response check for len(). I tried app_iter also like this:
return Response(app_iter=[body], content_type=mimetype)
But, if I did like this, the wsgiref will complain about the body is not String type.
===========
2012-12-29 23:33:59,521 INFO [fs.tahoelafs][MainThread] (4363489744) Opening file /family/Ada/IMG_0355.JPG in mode rb
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 127, in finish_response
self.write(data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 202, in write
assert type(data) is StringType,"write() argument must be string"
AssertionError: write() argument must be string
==========
Is there anyway to work around this?
Thanks a lot in advance!
-Shu