simplify and factorize code, remove dead code, follow conventions, use new-style classes

This commit is contained in:
Christophe Benz 2010-12-09 15:27:06 +01:00 committed by Romain Bignon
commit f1b3264a67
28 changed files with 202 additions and 251 deletions

View file

@ -25,7 +25,8 @@ class TileError(Exception):
Exception.__init__(self, msg)
self.tile = tile
class Captcha:
class Captcha(object):
def __init__(self, file):
self.inim = Image.open(file)
self.nx,self.ny = self.inim.size
@ -77,7 +78,8 @@ class Captcha:
y += 25
ty += 1
class Tile:
class Tile(object):
hash = {'b2d25ae11efaaaec6dd6a4c00f0dfc29': 1,
'600873fa288e75ca6cca092ae95bf129': 2,
'da24ac28930feee169adcbc9bad4acaf': 3,
@ -117,4 +119,3 @@ class Tile:
for pxl in pxls:
sys.stdout.write('%02d' % pxl)
sys.stdout.write('\n')

View file

@ -24,7 +24,6 @@ __all__ = ['AccountComing']
class AccountComing(BasePage):
def on_loaded(self):
self.operations = []

View file

@ -24,7 +24,6 @@ __all__ = ['AccountHistory']
class AccountHistory(BasePage):
def on_loaded(self):
self.operations = []

View file

@ -24,6 +24,10 @@ from weboob.tools.browser import BasePage
from ..errors import PasswordExpired
__all__ = ['AccountsList']
class AccountsList(BasePage):
LINKID_REGEXP = re.compile(".*ch4=(\w+).*")

View file

@ -55,9 +55,11 @@ class LoginPage(BasePage):
self.browser['ch5'] = img.get_codes(password)
self.browser.submit()
class ConfirmPage(BasePage):
pass
class ChangePasswordPage(BasePage):
def change_password(self, current, new):
img = Captcha(self.browser.openurl('/NSImgGrille'))

View file

@ -15,6 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import re
from weboob.tools.browser import BasePage
@ -56,6 +57,7 @@ class TransferPage(BasePage):
self.browser['T5'] = reason
self.browser.submit()
class TransferConfirmPage(BasePage):
def on_loaded(self):
for td in self.document.getroot().cssselect('td#size2'):
@ -67,6 +69,7 @@ class TransferConfirmPage(BasePage):
self.browser.location('/NS_VIRDA?stp=%s' % m.group(1))
return
class TransferCompletePage(BasePage):
def get_id(self):
return self.group_dict['id']