several fixes

This commit is contained in:
Romain Bignon 2010-08-12 18:04:20 +02:00
commit af08bd0eeb
4 changed files with 10 additions and 5 deletions

View file

@ -36,6 +36,7 @@ class AccountComing(BasePage):
date = tds[0].getchildren()[0].attrib.get('name', '') date = tds[0].getchildren()[0].attrib.get('name', '')
label = u'' label = u''
label += tds[1].text label += tds[1].text
label = label.replace(u'\xa0', u'')
for child in tds[1].getchildren(): for child in tds[1].getchildren():
if child.text: label += child.text if child.text: label += child.text
if child.tail: label += child.tail if child.tail: label += child.tail
@ -43,7 +44,7 @@ class AccountComing(BasePage):
label = label.strip() label = label.strip()
amount = tds[2].text.replace('.', '').replace(',', '.') amount = tds[2].text.replace('.', '').replace(',', '.')
operation = Operation() operation = Operation(len(self.operations))
operation.date = date operation.date = date
operation.label = label operation.label = label
operation.amount = float(amount) operation.amount = float(amount)

View file

@ -45,7 +45,7 @@ class AccountHistory(BasePage):
label = label.strip() label = label.strip()
amount = tds[2].text.replace('.', '').replace(',', '.') amount = tds[2].text.replace('.', '').replace(',', '.')
# if we don't have exactly one '.', this is not a floatm try the next # if we don't have exactly one '.', this is not a floatm try the next
operation = Operation() operation = Operation(len(self.operations))
if amount.count('.') != 1: if amount.count('.') != 1:
amount = tds[3].text.replace('.', '').replace(',', '.') amount = tds[3].text.replace('.', '').replace(',', '.')
operation.amount = float(amount) operation.amount = float(amount)

View file

@ -55,5 +55,9 @@ class CragrBackend(BaseBackend, ICapBank):
raise AccountNotFound() raise AccountNotFound()
def iter_operations(self, account): def iter_operations(self, account):
""" Not supported yet """ """ TODO Not supported yet """
return iter([])
def iter_history(self, account):
""" TODO Not supported yet """
return iter([]) return iter([])

View file

@ -62,8 +62,8 @@ class Account(CapBaseObject):
class Operation(CapBaseObject): class Operation(CapBaseObject):
FIELDS = ('date', 'label', 'amount') FIELDS = ('date', 'label', 'amount')
def __init__(self): def __init__(self, id):
CapBaseObject(self, 0) CapBaseObject.__init__(self, id)
self.date = None self.date = None
self._label = u'' self._label = u''
self._amount = 0.0 self._amount = 0.0