X-Git-Url: https://projects.mako.cc/source/iron-blogger/blobdiff_plain/6453bb4008557655500c8c3d42db48014b484c47..1f7dc446904fd3599a72d7edba15e307a683fdf3:/render.py diff --git a/render.py b/render.py index 58a1fc4..58cb92e 100755 --- a/render.py +++ b/render.py @@ -13,10 +13,7 @@ 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, + p = subprocess.Popen(BALANCE_CMD + [acct], stdout=subprocess.PIPE) (out, _) = p.communicate() return float(re.sub(r'\s*(\d+)\s+.*', r'\1', out)) @@ -30,6 +27,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 +100,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):