21 with open('ledger', 'a') as f:
23 f.write(render.render_template('templates/ledger', date))
26 subprocess.check_call(["git", "commit", "ledger",
27 "-m", "Update for %s" % (date,)])
29 debts = render.get_debts()
32 with open('ledger', 'a') as f:
34 for (user, debt) in debts:
35 if debt < (FINE_SIZE * 6): continue
39 Pool:Owed:%(user)s -%(debt)s
41 """ % {'user': user, 'debt': debt, 'date': date})
45 text = render.render_template('templates/week.tmpl', date, punt=punt)
47 lines = text.split("\n")
49 body = "\n".join(lines[1:])
51 page = dict(title = title, description = body)
54 subprocess.call(['stty', '-echo'])
55 passwd = raw_input("Password for %s: " % (USER,))
58 subprocess.call(['stty', 'echo'])
60 x = xmlrpclib.ServerProxy(XMLRPC_ENDPOINT)
61 x.metaWeblog.newPost(BLOG_ID, USER, passwd, page, True)
63 email = render.render_template('templates/email.txt', date, punt=punt)
68 p = subprocess.Popen(['mutt', '-H', '/dev/stdin'],
69 stdin=subprocess.PIPE)
73 with open('bloggers.yml') as b:
74 bloggers = yaml.safe_load(b)
76 if 'end' not in bloggers[p]:
77 bloggers[p]['end'] = date
78 with open('bloggers.yml','w') as b:
79 yaml.safe_dump(bloggers, b)
82 subprocess.check_call(["git", "commit", "ledger", "bloggers.yml",
83 "-m", "Punts for %s" % (date,)])
85 # if it's a dry run, lets set the ledger back to the beginning state
87 subprocess.check_call(["git", "checkout", "ledger"])
90 subprocess.check_call(["git", "checkout", "bloggers.yml"])