Re: Return media files (such as jpg, png) in Response body other than String

2012-12-30 Thread Shu Lin
I figured it out the reason is the package I used, pyfilesystem, http://code.google.com/p/pyfilesystem/ I used the RemoteFileBuffer. Now, I use RemoteFileBuffer._read() to get out the local buffer object which makes the Response.body happy. Thanks a lot for all the helps! -Shu On Sunday, Decem

Re: Return media files (such as jpg, png) in Response body other than String

2012-12-30 Thread Chris McDonough
On Sun, 2012-12-30 at 18:13 -0800, Shu Lin wrote: > Hi, > > > If I have other objects other than String, which is holding a jpg or > png file, I like to return it as Response body, how can I do? > > > I tried a piece of code like this: > > > mimetype = image/png > body = fs.open(acces

Re: Return media files (such as jpg, png) in Response body other than String

2012-12-30 Thread Gael Pasgrimaud
Hi, Le 31/12/2012 03:13, Shu Lin a écrit : Hi, If I have other objects other than String, which is holding a jpg or png file, I like to return it as Response body, how can I do? I tried a piece of code like this: mimetype = image/png body = fs.open(access_path, 'rb') return Re

Return media files (such as jpg, png) in Response body other than String

2012-12-30 Thread Shu Lin
Hi, If I have other objects other than String, which is holding a jpg or png file, I like to return it as Response body, how can I do? I tried a piece of code like this: mimetype = image/png body = fs.open(access_path, 'rb') return Response(body, content_type=mimetype) Here "body"