Extract method to allow extensions (#109)

This commit is contained in:
Andrea Stirpe
2017-05-17 10:12:19 +02:00
committed by Stefan Rijnhart (Opener)
parent e0c8a9126c
commit 842ced8ee0

View File

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