code clean, split too long lines

This commit is contained in:
Christophe Benz 2010-12-08 16:58:14 +01:00 committed by Romain Bignon
commit 851b2d34ca
10 changed files with 132 additions and 108 deletions

View file

@ -15,18 +15,22 @@
# 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.capabilities.bank import Operation
from weboob.tools.browser import BasePage
__all__ = ['AccountHistory']
def remove_html_tags(data):
p = re.compile(r'<.*?>')
return p.sub(' ', data)
def remove_extra_spaces(data):
p = re.compile(r'\s+')
return p.sub(' ', data)
@ -34,9 +38,10 @@ def remove_extra_spaces(data):
class AccountHistory(BasePage):
def on_loaded(self):
if self.document.docinfo.doctype == '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">':
if self.document.docinfo.doctype == '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" '
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">':
self.browser.follow_link(url_regex="releve", tag="a")
def get_history(self):
mvt_table = self.document.xpath("//table[@id='mouvements']", smart_strings=False)[0]
mvt_ligne = mvt_table.xpath("./tbody/tr")
@ -49,7 +54,6 @@ class AccountHistory(BasePage):
tp = mvt.xpath("./td")[1]
operation.label = remove_extra_spaces(remove_html_tags(self.browser.parser.tostring(tp)))
r = re.compile(r'\d+')
tp = mvt.xpath("./td/span")
amount = None