def report(): data = Data() codes = data.getallkeys() for code in codes: invite = data.getvalue(code) if 'actual_guests' in invite: print '%s: %s %s attending: %s guests: %s' % (code, invite['firstname'], invite['lastname'], invite['attending'], invite['actual_guests'])
def report(): data = Data() total = 0 codes = sorted(data.getallkeys()) for code in codes: invite = data.getvalue(code) if "actual_guests" in invite: date = "N/A" if "time" in invite: date = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(float(invite["time"]))) yield "%-24s" "%s %-20s %-20s" "%-8s" "%-4s\n" % ( date, code, invite["firstname"], invite["lastname"], invite["attending"], invite["actual_guests"], ) total += int(invite["actual_guests"]) yield "total: %s\n" % total