Luís Murta 9b45ee4817
Update the export operation
to work with the Manager.
Also removes the run method from the runnable.py, since everything is
done in the __main__.py file of the pfbudget module.
2023-01-08 19:41:07 +00:00

18 lines
450 B
Python

from csv import writer
from pfbudget.db.model import Transaction
from .output import Output
class CSV(Output):
def __init__(self, filename: str):
self.fn = filename
def report(self, transactions: list[Transaction]):
with open(self.fn, "w", newline="") as f:
w = writer(f, delimiter="\t")
w.writerows(
[(t.date, t.description, t.amount, t.bank) for t in transactions]
)