Пример #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
 def record_like_comment(mapper, conn, target):
     run_task(_record_like_comment, target)
Пример #8
0
 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)