zope.testbrowser fails badly when calling .contents on a new Browser instance

Bug #419119 reported by Valentin Lab
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 3
Fix Released
Undecided
Wolfgang Schnerring
zope.testbrowser
Fix Released
Undecided
Unassigned

Bug Description

On a new instance of Browser (of zope.testbrowser), asking contents before open()ing an URL fails badly:

>>> browser = Browser()
>>> browser.contents
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'tell'

The exception is not very clear, and it might not be the correct way to handle this case. Mechanize answers with "None".
We should just avoid trying to get further if we receive None and return None also.

I've joined a patch with a test.

Revision history for this message
Valentin Lab (vaab) wrote :
Revision history for this message
Valentin Lab (vaab) wrote :

forgot the bug URL in the comments of the last patch

Revision history for this message
Wolfgang Schnerring (wosc) wrote :

I agree, browser.contents should simply return None in that case. Thanks for the patch, applied (with minor tweaks) in r103586.

Changed in zope3:
assignee: nobody → Wolfgang Schnerring (wosc)
status: New → Fix Committed
Revision history for this message
Tres Seaver (tseaver) wrote :

Released with zope.testbrowser 3.7.0:

 http://pypi.python.org/pypi/zope.testbrowser/3.7.0

Changed in zope.testbrowser:
status: New → Fix Released
Tres Seaver (tseaver)
Changed in zope3:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.