Show Image with WebKit

Marcos Alcazar marcos.alcazar at gmail.com
Tue Feb 5 10:36:00 EST 2008


Hello to everybody, I'm from Argentina.

My problem is the next. I receive in the request one image that i've
upload, and I want to show that again in another page, how can i do that? I
try this:

from WebKit.Page import Page
class gestorControl(Page):
    def actions(self):
        return Page.actions(self) + ["upload"]

    def writeContent(self):
        tweb = self.transaction()
        file = self.request().field('archivo')
        data = file.value
        res = self.response()
        wr = self.write
        res.setHeader("Content-type", "image/jpeg")
        wr(data)
        res.flush()

I know that the header is setted right (I checked that with a firefox
plugin, I don't remember now its name), but the "data" that I'm sending is
showed as chars, not as an image.
My problem persists if I change Page for HTTPContent.
What I'm doing wrong? Is what I want possible?

Thanks, and sorry for my english :)

Marcos Alcazar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080205/4af1cfb1/attachment.html>


More information about the Python-list mailing list