added quick view
uses param -q quick view is a dry run too
This commit is contained in:
parent
bf023c2ea9
commit
8d459d81a0
|
@ -0,0 +1,23 @@
|
|||
## -*- coding: utf-8 -*-
|
||||
Subject: IRON BLOGGER results for the week beginning ${week_start.strftime("%F")}
|
||||
|
||||
SLACKERS: ${", ".join(sorted([u.username for u in lame]))}
|
||||
% if punt:
|
||||
PUNTED for balance ≥$30: ${", ".join(sorted(punt))}
|
||||
% endif
|
||||
|
||||
People who posted: ${", ".join(sorted([u.username for u in good]))}
|
||||
|
||||
% if skip:
|
||||
People who have not yet started: ${", ".join(sorted([u.username for u in skip]))}
|
||||
% endif
|
||||
|
||||
Beer pool:
|
||||
This week: € ${5 * len(lame)}
|
||||
Total: € ${pool}
|
||||
Paid: € ${paid}
|
||||
Events: € ${event}
|
||||
Individual debts:
|
||||
% for (u, v) in sorted(debts, key=lambda p:p[1], reverse=True):
|
||||
${u"%20s %d \u20AC" % (u, v)}
|
||||
% endfor
|
|
@ -12,8 +12,14 @@ import settings
|
|||
config=settings.load_settings()
|
||||
|
||||
dry_run = False
|
||||
quick_view = False
|
||||
|
||||
args = sys.argv[1:]
|
||||
if args[0] == '-q':
|
||||
dry_run = True
|
||||
quick_view = True
|
||||
args = args[1:]
|
||||
|
||||
if args[0] == '-n':
|
||||
dry_run = True
|
||||
args = args[1:]
|
||||
|
@ -63,10 +69,12 @@ if not dry_run:
|
|||
x = xmlrpclib.ServerProxy(config['xmlrpc_endpoint'])
|
||||
x.metaWeblog.newPost(config['blog_id'], config['username'], passwd, page, True)
|
||||
email = render.render_template('templates/email.txt', date, punt=punt,mail=config['mail'])
|
||||
|
||||
if dry_run:
|
||||
quick = render.render_template('templates/quick_view.tmpl',date,punt=punt)
|
||||
if quick_view:
|
||||
print quick
|
||||
if dry_run and not quick_view:
|
||||
print email
|
||||
else:
|
||||
if not dry_run:
|
||||
p = subprocess.Popen(['mutt', '-H', '/dev/stdin'],
|
||||
stdin=subprocess.PIPE)
|
||||
p.communicate(email)
|
||||
|
|
Loading…
Reference in New Issue