mechanize 0.2 uses its own ControlNotFoundError exception

This commit is contained in:
Romain Bignon 2010-06-26 13:38:48 +02:00
commit d5b1105b9c
3 changed files with 16 additions and 6 deletions

View file

@ -19,7 +19,10 @@
import mechanize
import urllib
import urllib2
import ClientForm
try:
from mechanize import ControlNotFoundError
except ImportError:
from ClientForm import ControlNotFoundError
import re
import time
from logging import warning, debug
@ -174,6 +177,7 @@ class BaseBrowser(mechanize.Browser):
if self.password:
try:
self.home()
# Do not abort the build of browser when the website is down.
except BrowserUnavailable:
pass
@ -367,5 +371,5 @@ class BaseBrowser(mechanize.Browser):
else:
value = self.str(args[label])
self[field] = value
except ClientForm.ControlNotFoundError:
except ControlNotFoundError:
return