示例#1
0
def send_delete_topic_email(email, topic):
    token = gen_salt(16)
    key = 'account:delete-topic:%s' % token
    redis.set(key, topic.id, ONE_DAY)
    url = full_url('account.delete_topic', token=token)
    title = 'Deteting %s' % topic.title
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)
示例#2
0
def send_delete_topic_email(email, topic):
    token = gen_salt(16)
    key = 'account:delete-topic:%s' % token
    redis.set(key, topic.id, ONE_DAY)
    url = full_url('account.delete_topic', token=token)
    title = 'Deteting %s' % topic.title
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)
示例#3
0
    def get_or_create(cls, link, user_id=None):
        link = sanitize_link(link)
        if not link.startswith('http'):
            return None

        uuid = hashlib.md5(link.encode('utf-8')).hexdigest()
        page = cls.query.get(uuid)
        if not page:
            page = cls(uuid=uuid, link=link, user_id=user_id)
            with db.auto_commit():
                db.session.add(page)
        if not page.info:
            run_task(page.fetch_update)
        return page
示例#4
0
    def get_or_create(cls, link, user_id=None):
        link = sanitize_link(link)
        if not link.startswith('http'):
            return None

        uuid = hashlib.md5(link.encode('utf-8')).hexdigest()
        page = cls.query.get(uuid)
        if not page:
            page = cls(uuid=uuid, link=link, user_id=user_id)
            with db.auto_commit():
                db.session.add(page)
        if not page.info:
            run_task(page.fetch_update)
        return page
示例#5
0
 def record_like_comment(mapper, conn, target):
     run_task(_record_like_comment, target)
示例#6
0
 def record_read_topic(mapper, conn, target):
     run_task(_record_read_topic, target)
示例#7
0
文件: binds.py 项目: 343829084/zerqu
 def record_like_comment(mapper, conn, target):
     run_task(_record_like_comment, target)
示例#8
0
文件: binds.py 项目: 343829084/zerqu
 def record_read_topic(mapper, conn, target):
     run_task(_record_read_topic, target)
示例#9
0
def send_change_password_email(email):
    token = create_email_signature(email, 'password')
    title = 'Change password for %s' % current_app.config['SITE_NAME']
    url = full_url('account.change_password', token=token)
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)
示例#10
0
def send_signup_email(email):
    token = create_email_signature(email, 'signup')
    url = full_url('account.signup', token=token)
    title = 'Sign up account for %s' % current_app.config['SITE_NAME']
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)
示例#11
0
def send_change_password_email(email):
    token = create_email_signature(email, 'password')
    title = 'Change password for %s' % current_app.config['SITE_NAME']
    url = full_url('account.change_password', token=token)
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)
示例#12
0
def send_signup_email(email):
    token = create_email_signature(email, 'signup')
    url = full_url('account.signup', token=token)
    title = 'Sign up account for %s' % current_app.config['SITE_NAME']
    text = '%s\n\n%s' % (title, url)
    run_task(send_text, email, title, text)