Fix for ClientForm in mechanize >=0.2

refs #362
This commit is contained in:
Laurent Bachelier 2010-08-10 18:15:22 +02:00
commit 05b9bbdb2e
5 changed files with 30 additions and 14 deletions

View file

@ -16,7 +16,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import ClientForm
from weboob.tools.mech import ClientForm
import sys
from weboob.tools.browser import BasePage

View file

@ -16,11 +16,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
try:
from mechanize import ControlNotFoundError
except ImportError:
from ClientForm import ControlNotFoundError
import ClientForm
from weboob.tools.mech import ClientForm
ControlNotFoundError = ClientForm.ControlNotFoundError
from .base import CragrBasePage

View file

@ -15,10 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
try:
from mechanize import ControlNotFoundError
except ImportError:
from ClientForm import ControlNotFoundError
from weboob.tools.mech import ClientForm
ControlNotFoundError = ClientForm.ControlNotFoundError
from mechanize import FormNotFoundError
from weboob.tools.browser import BasePage

View file

@ -19,10 +19,8 @@
import mechanize
import urllib
import urllib2
try:
from mechanize import ControlNotFoundError
except ImportError:
from ClientForm import ControlNotFoundError
from weboob.tools.mech import ClientForm
ControlNotFoundError = ClientForm.ControlNotFoundError
import re
import time
from logging import warning, debug

23
weboob/tools/mech.py Normal file
View file

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Laurent Bachelier
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import mechanize
if hasattr(mechanize, "FormParser"):
ClientForm = mechanize
else:
import ClientForm