]> projects.mako.cc - iron-blogger/commitdiff
update the rest of the code to support the new config format
authorBenjamin Mako Hill <mako@atdot.cc>
Tue, 14 Aug 2012 05:47:01 +0000 (01:47 -0400)
committerBenjamin Mako Hill <mako@atdot.cc>
Tue, 14 Aug 2012 05:47:01 +0000 (01:47 -0400)
config.py
render.py
templates/ledger
weekly-update.py

index d112ea5dfe3e5c9889cde8d1c44bec6b45db7a45..fa3a133f1ea28c0d4e1daad4333f7bd86c79609f 100644 (file)
--- a/config.py
+++ b/config.py
@@ -17,7 +17,7 @@ FINE_SIZE = 5
 CURRENCY = "$"
 
 # check the version of ledger to find out which commands to use
-if subprocess.check_output(['ledger', '--version'])[7] == 3:
+if subprocess.check_output(['ledger', '--version'])[7] == "3":
     BALANCE_CMD = ['ledger', '-f', os.path.join(HERE,'ledger'),
                    '--no-color', '-n', 'balance']
 
index 58a1fc4371ed83333df3577138c387f1786439d7..6d6415eea204e612606aa966cb93394d2fa423d0 100755 (executable)
--- a/render.py
+++ b/render.py
@@ -13,7 +13,6 @@ from mako.template import Template
 from config import *
 
 def get_balance(acct):
-    print acct
     balance_cmd_tmp = BALANCE_CMD
     balance_cmd_tmp.append(acct)
     p = subprocess.Popen(balance_cmd_tmp,
@@ -30,6 +29,7 @@ def get_debts():
         if not line: continue
         (val, acct) = line.split()
         user = acct[len("Pool:Owed:"):]
+        if not user: continue
         val = float(re.sub(r'(\D)?(\d+)$', r'\2', val))
         debts.append((user, val))
     return debts
@@ -102,7 +102,7 @@ def render_template(path, week=None, **kwargs):
 
     for u in userlist:
         user_start = datetime.datetime(*(u.start.timetuple()[:6]))
-        if u.end and parse(u.end, default=START) <= week_start:
+        if u.end and datetime.datetime(*(u.end.timetuple()[:6])) <= week_start:
             continue
         
         if should_skip(u.skip, week):
index 3478d8b44874f2c9991dc8bc946939cc39a3bc35..56d06e0428406544ea77d2898682daad014d1ea3 100644 (file)
@@ -1,5 +1,5 @@
 % for u in sorted(lame, key=lambda u:u.username):
-${week_end.strftime("%F")} Week ${week}
+${week_end.strftime("%F")} Fine Week ${week}
   User:${u.username}    -${fine}
   Pool:Owed:${u.username}
 % endfor
index 8b60e527541e4e2dd9d5a3462491d57a6038db87..eddb2c170499de152e80e45296eef551ac5ce683 100755 (executable)
@@ -32,7 +32,7 @@ punt = []
 with open('ledger', 'a') as f:
     f.write("\n")
     for (user, debt) in debts:
-        if debt < (FINE_SIZE * 6): continue
+        if debt <= (FINE_SIZE * 6): continue
         punt.append(user)
         f.write("""\
 %(date)s Punt

Benjamin Mako Hill || Want to submit a patch?