Prepare for floating-point values in ledger
[iron-blogger] / render.py
index 0a7bf46f488d68095a370ac722467aa8631d2c82..0fa0489434bcea6f0222c511f23adaea04f7c25a 100755 (executable)
--- a/render.py
+++ b/render.py
@@ -71,7 +71,7 @@ def render_template(path, week=None):
                               '-n', 'balance', acct],
                              stdout=subprocess.PIPE)
         (out, _) = p.communicate()
-        return int(out.split()[0][1:])
+        return float(out.split()[0][1:])
 
     p = subprocess.Popen(['ledger', '-f', os.path.join(HERE,'ledger'),
                           '-n', 'balance', 'Pool:Owed:'],
@@ -82,7 +82,7 @@ def render_template(path, week=None):
         if not line: continue
         (val, acct) = line.split()
         user = acct[len("Pool:Owed:"):]
-        val  = int(val[len("$"):])
+        val  = float(val[len("$"):])
         debts.append((user, val))
 
     return Template(filename=path, output_encoding='utf-8').render(

Benjamin Mako Hill || Want to submit a patch?