From f2162bf7ee556c5d46a3a48a4d93bb892041b067 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 14 Sep 2004 06:36:16 -0400 Subject: further python integration improvements --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index e30e229e..24fdc2b6 100644 --- a/main.py +++ b/main.py @@ -16,6 +16,9 @@ add_option_handler ("goodbye", ":", goodbye) args = process_arguments (sys.argv[1:]) process_environment (os.environ, "LEDGER_") +if len (args) > 0: + config.process_options (args[0], args[1:]) + text_parser = TextualParser () register_parser (text_parser) @@ -30,14 +33,14 @@ class FormatTransaction (TransactionHandler): def __call__ (self, xact): print self.formatter.format(xact) -def foo(d, val): - return d.xact.amount + val +expr = parse_value_expr ("a*2") + +def foo(x, val): + return x.xact.amount + expr.compute (x) + val handler = FormatTransaction("%D %-20P %N %('foo'{$100})") handler = FilterTransactions (handler, "/Checking/") -expr = parse_value_expr ("a*2") - for entry in journal: for xact in entry: handler (xact) -- cgit v1.2.3