From ff4589caae7b5bd40350eac605916d085b5106cc Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 10 Sep 2004 20:08:07 -0400 Subject: added support for ValueExpr objects to python. --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 1e25b7ed..cad0e6e8 100644 --- a/main.py +++ b/main.py @@ -20,16 +20,19 @@ register_parser (parser) journal = Journal () parse_journal_file (args[0], journal) -class OutputTransaction (TransactionHandler): - def __init__ (self): - self.formatter = Format ("%D %-20P %N") +class FormatTransaction (TransactionHandler): + def __init__ (self, fmt): + self.formatter = Format (fmt) TransactionHandler.__init__ (self) + def __call__ (self, xact): print self.formatter.format(xact) -handler = OutputTransaction() +handler = FormatTransaction("%D %-20P %N") handler = FilterTransactions (handler, "/Checking/") +expr = parse_value_expr ("a*2") + for entry in journal: for xact in entry: handler (xact) -- cgit v1.2.3