[FIX] uk_hsbc statement import was not parsing detail lines

Fixed a problem with a recent change to the regexp string causing it
to no longer match against statement lines due to backslash.

Also fixed testing code when running from the command line
This commit is contained in:
Chris Halls
2015-01-07 13:28:49 -02:00
parent 32bb8906a8
commit 54bfe28936

View File

@@ -50,18 +50,18 @@ class HSBCParser(object):
r"(?P<startingbalance>[\d,]{1,15})")
# Transaction
recparse["61"] = r"""\
:(?P<recordid>61):\
(?P<valuedate>\d{6})(?P<bookingdate>\d{4})?\
(?P<creditmarker>R?[CD])\
(?P<currency>[A-Z])?\
(?P<amount>[\d,]{1,15})\
(?P<bookingcode>[A-Z][A-Z0-9]{3})\
(?P<custrefno>[%(ebcdic)s]{1,16})\
(?://)\
(?P<bankref>[%(ebcdic)s]{1,16})?\
(?:\n(?P<furtherinfo>[%(ebcdic)s]))?\
""" % (patterns)
recparse["61"] = (r"""
:(?P<recordid>61):
(?P<valuedate>\d{6})(?P<bookingdate>\d{4})?
(?P<creditmarker>R?[CD])
(?P<currency>[A-Z])?
(?P<amount>[\d,]{1,15})
(?P<bookingcode>[A-Z][A-Z0-9]{3})
(?P<custrefno>[%(ebcdic)s]{1,16})
(?://)
(?P<bankref>[%(ebcdic)s]{1,16})?
(?:\n(?P<furtherinfo>[%(ebcdic)s]))?
""" % (patterns)).replace('\n','')
# Further info
recparse["86"] = (r":(?P<recordid>86):"
@@ -156,7 +156,7 @@ class HSBCParser(object):
def parse_file(filename):
with open(filename, "r") as hsbcfile:
HSBCParser().parse(hsbcfile.readlines())
HSBCParser().parse(None, hsbcfile.readlines())
def main():