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)
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
def record_like_comment(mapper, conn, target): run_task(_record_like_comment, target)
def record_read_topic(mapper, conn, target): run_task(_record_read_topic, target)
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)
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)