use the lxml parser (elementtidy is now deprecated)

This commit is contained in:
Romain Bignon 2010-04-30 18:09:37 +02:00
commit 16318dcbf6
2 changed files with 2 additions and 12 deletions

View file

@ -21,17 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from cStringIO import StringIO
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword
from weboob.tools.parsers.elementtidyparser import ElementTidyParser
from weboob.backends.bnporc import pages
# Parser
class BNParser(ElementTidyParser):
def parse(self, data, encoding):
s = data.read()
s = s.replace('<?Pub Caret>', '')
data = StringIO(s)
return ElementTidyParser.parse(self, data, encoding)
# Browser
class BNPorc(BaseBrowser):
DOMAIN = 'www.secure.bnpparibas.net'
@ -49,7 +40,6 @@ class BNPorc(BaseBrowser):
is_logging = False
def __init__(self, *args, **kwargs):
kwargs['parser'] = BNParser()
kwargs['history'] = None # need history
BaseBrowser.__init__(self, *args, **kwargs)

View file

@ -28,7 +28,6 @@ class AccountComing(BasePage):
for tr in self.document.getiterator('tr'):
if tr.attrib.get('class', '') == 'hdoc1' or tr.attrib.get('class', '') == 'hdotc1':
operation = Operation()
tds = tr.findall('td')
if len(tds) != 3:
continue
@ -38,10 +37,11 @@ class AccountComing(BasePage):
for child in tds[1].getchildren():
if child.text: label += child.text
if child.tail: label += child.tail
label += tds[1].tail
if tds[1].tail: label += tds[1].tail
label = label.strip()
amount = tds[2].text.replace('.','').replace(',','.')
operation = Operation()
operation.setDate(date)
operation.setLabel(label)
operation.setAmount(float(amount))