Whoops, I just needed to refer to the direct binary data, it was
passing an object in.



On Tue, Oct 11, 2011 at 12:11 PM, Matt Broadstone <mbroa...@gmail.com> wrote:
> Greetings,
>   I am trying to serve binary image data from one of my controllers.
> The data comes in via xmlrpc, and as such I have access to an xmlrpc
> Binary object of the image data. I've written a controller that tries
> to emulate what response.download does, but it doesn't seem to work.
> Can anyone point me in the right direction here:
>
> def view():
>    icon_name = request.vars.name if request.vars else None
>    icon_name = urllib.unquote(icon_name)
>
>    if icon_name:
>        icon_object = bw.objectQuery("icon", icon_name)
>        response.headers['Content-Type'] = 'image/png'
>        icon_stream = cStringIO.StringIO(icon_object['icon'])
>        return response.stream(icon_stream, request=request);
>
> Matt
>

Reply via email to