re-posting: web.py, incomplete

_wolf wolfgang.lipp at gmail.com
Thu Mar 2 20:38:52 CET 2006


hi all,

this is a re-posting of my question i asked a month or so ago. i
installed web.py, flups, and cheetah. when i copy'n'paste the sample
app from then http://webpy.org homepage ::

    import web

    urls = (
        '/(.*)', 'hello'
    )

    class hello:
        def GET(self, name):
            i = web.input(times=1)
            if not name: name = 'world'
            for c in xrange(int(i.times)): print 'Hello,', name+'!'
            # point (1)

    if __name__ == "__main__": web.run(urls)

it does seem to work *but* when i call it with sth like

    http://localhost/cgi-bin/webpyexample.py/oops?times=25

then the output is ::

    Hello, oops!
    Hello, oops!
    <20 lines omitted/>
    Hello, oops!
    Hel

it is only after i insert, at point (1) as shown in the listing, ::

    print ( ( ' ' * 100 ) + '\n' ) * 10

---print ten lines with a hundred space characters each---that
i do get to see all twenty-five helloes. so, this is likely a
character buffering problem. as far as i can see, it is a consistent
amount of the last 32 characters that is missing from the page
source. ok i thought so let's just output those 32 characters, ::

    print ' ' * 32

but *this* will result in a last output line that is 8 characters
long, so someone swallows 24 characters. does look like
a buffer of fixed length. 

i'd like to bust that ghost.

_wolf




More information about the Python-list mailing list