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.
18 lines
450 B
Python
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]
|
|
)
|