def send_client_notify(notify_id): with app.app_context(): print notify_id notify = db.session.query(Notify).filter_by(id=notify_id).first() if not notify: return "fail" if notify: notify_json = json.dumps(notify.serialize_to_admin()) clients = redisDB.smembers('clients') for c in clients: if c: key = RedisFormatKey.NOTIFY % (notify.type, c) redisDB.rpush(key, notify_json) default_key = RedisFormatKey.NOTIFY_DEFAULT % (notify.type) redisDB.rpush(default_key, notify_json) return "success"
def send_async_email(to, subject, template): with app.app_context(): send_email(to, subject, template)