X-Original-To: ti...@caltech.edu
Date: Tue, 21 Mar 2006 16:20:17 -0500
From: John Mudd <john...@gmail.com>
To: tw...@lists.idyll.org
Subject: [twill] StringIO?
Um, I'm able to capture the output as a string. I was hoping calling
the truncate() method would reset the StringIO() thing. Doesn't
though. It just accumulates. I must be way off base by now.
Looking for StringIO docs. Standard Python doesn't help much.
Looking... Fredrik Lundh examples. Is this where StringIO came from?
Seems like it could be useful, in rare cases.
Is this really necessary? Why not just return the output as a string
by default? Let me decide if I want to print it. Leave the
auto-print to twill-sh only. Just like Python, print result in
interactive mode. Return result in scripts.
John
import StringIO
print dir(StringIO)
output = StringIO.StringIO()
twill.set_output(output)
b = twill.get_browser()
b.go('http://www.xxxxxxxxxx.com/webmail')
print 'output=%s' % output.getvalue()
output.truncate()
b.showforms()
print 'output=%s' % output.getvalue()
output.truncate()
print 'dir(output)=%s' % dir(output)
_______________________________________________
twill mailing list
tw...@lists.idyll.org
http://lists.idyll.org/listinfo/twill
----- End forwarded message -----
--
C. Titus Brown, c...@msu.edu