[twill] Debugging twill
Titus Brown
titus at caltech.edu
Sun Nov 27 14:26:03 PST 2005
On Wed, Nov 23, 2005 at 02:30:29PM +0530, sureshvv wrote:
-> Titus Brown wrote:
-> ->
-> > -> I was able to make it work by patching _mech_open() method in _mechanize.py as
-> > -> follows:
-> > ->
-> > -> Around line 281, change
-> > ->
-> > -> < self._response = UserAgent.open(self, self.request, data)
-> > ->
-> > -> to
-> > ->
-> > -> > try:
-> > -> > self._response = UserAgent.open(self, self.request, data)
-> > -> > except urllib2.HTTPError, e:
-> > -> > self._response = e
-> > ->
-> >
-> > It makes me more interested than ever in what is happening in your case!
-> > If you look in 'utils.py', function 'journey', I do almost exactly the
-> > same thing. I don't have a good idea of where your approach should
-> > differ the one in twill already... I'll have to look at the code with
-> > this in mind.
->
-> Yep... I copied it from there :)
->
-> Unfortunately it is too late in journey, since mechanize already thinks that
-> there is an error and does not save the response in self._response. Later on,
-> when you try to viewing_html(), it says Not viewing a page.
->
-> So the fix needs to be done at the mechanize level.
hi, Suresh,
thanks for this report. I finally managed to duplicate your bug -- it
depended on the restricted page being loaded *after* a non-HTML page --
and after a certain amount of agonized deliberating, decided that
patching mechanize directly is the proper way to go.
I'm a bit worried that this won't make it into the trunk mechanize
source without some more work, but that will depend entirely on what
John thinks.
thanks,
--titus
More information about the twill
mailing list