[twill] 0.7.3, assume html patch

Titus Brown titus at caltech.edu
Sat Oct 29 15:32:35 PDT 2005


-> G'day Titus,
-> 
-> The web server was consistently failing to send a Content-Type if twill
-> was used to query it during evening hours.  The debug http confirmed it.
-> 
-> Apparently some browsers assume it is text/html and proceed regardless.
-> 
-> The attached patch adds an assume_html() method to mechanize.  I know
-> you'd rather not take patches for something that is upstream of you, but
-> I thought I'd mention how it was solved in the end.  I could not find a
-> way to solve it without this change.

James,

I came across my own problems with mechanize, and needed a way to
selectively override MechanizeBrowser.  In the process of arranging
that -- see the new 'browser.py', class 'PatchedMechanizeBrowser' --
I realized that I could just override 'viewing_html' to do the right
thing for your situation.

So, PatchedMechanizeBrowser now assumes that text/xml is HTML, and
assumes that an absence of content-type is indicative of text/html.

If other people run into issues with these changes, then I'll implement
your boolean flag idea too.

Let me know if you get a chance to try out the latest twill & find
that it solves your problems.  (I'll post to this list when I finish
the hacking and post the changes.)

thanks,
--titus



More information about the twill mailing list