Skip to content

Commit

Permalink
fix: allow file_date() to be called without initialization #61
Browse files Browse the repository at this point in the history
  • Loading branch information
redstreet committed May 6, 2023
1 parent fac2c2b commit 109d754
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions beancount_reds_importers/libreader/ofxreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ def match_account_number(self, file_account, config_account):
return file_account == config_account

def file_date(self, file):
"Get the maximum date from the file."
return self.ofx_account.statement.end_date
"""Get the ending date of the statement."""
if not getattr(self, 'ofx_account', None):
self.initialize(file)
try:
return self.ofx_account.statement.end_date
except AttributeError:
return None

def read_file(self, file):
pass
Expand Down

0 comments on commit 109d754

Please sign in to comment.