app.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:census 作者: ioddly 项目源码 文件源码
def followup(dry_run):
    if dry_run:
        print("DRY RUN -- Not sending actual emails")
        config['DEBUG'] = True

    "Run after changing the question schema; sends out email updates. Recommended at most once per month."
    emails = []
    usrs = []
    for user in r.table('users').run(conn()):

        if 'subscribed' not in user or user['subscribed'] == False:
            # Ignore anonymous or unsubscribed users
            continue
        # Get email for email/xenforo accounts
        usrs.append(user)
        emails.append(user['email'] if 'email' in user else user['identity'])

    print("Sending emails to the following %s users", (len(emails), emails))
    desc = sys.stdin.read()

    for user in usrs:
        users.mail(user, 'Questions have been updated',
"""You are receiving this email because the questions have been updated. Please consider logging in and updating your response.<br>
<br>
Update notes:<br>
%s<br>
""" % desc.replace('\n', '<br>'),
"""You are receiving this email because the questions have been updated. Please conisder logging in and updating your response\n
\n
Update notes:%s\n""" % desc, use_flash = False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号