Browse Source

Extract method to allow extensions (#109)

pull/137/head
Andrea Stirpe 8 years ago
committed by Fekete Mihai
parent
commit
1cb6956f0f
  1. 6
      account_bank_statement_import_mt940_base/mt940.py

6
account_bank_statement_import_mt940_base/mt940.py

@ -153,7 +153,7 @@ class MT940(object):
self.handle_header(line, iterator) self.handle_header(line, iterator)
line = iterator.next() line = iterator.next()
if not self.is_tag(line) and not self.is_footer(line): if not self.is_tag(line) and not self.is_footer(line):
record_line += line
record_line = self.add_record_line(line, record_line)
continue continue
if record_line: if record_line:
self.handle_record(record_line) self.handle_record(record_line)
@ -172,6 +172,10 @@ class MT940(object):
self.current_statement = None self.current_statement = None
return self.statements return self.statements
def add_record_line(self, line, record_line):
record_line += line
return record_line
def is_footer(self, line): def is_footer(self, line):
"""determine if a line is the footer of a statement""" """determine if a line is the footer of a statement"""
return line and bool(re.match(self.footer_regex, line)) return line and bool(re.match(self.footer_regex, line))

Loading…
Cancel
Save