def send_emails(): with app.app_context(): users, total = User.list_users() for u in users: if u.id: if not u.send_doc_email(): print '!!! sending doc email error !!!' else: print 'uid error' print 'all emails have been sent.'
def index(): admin = request.args.get('admin') users, total = User.list_users(admin=admin, start=g.start, limit=g.limit) return render_template('/admin.html', users=users, total=total, endpoint='admin.index', admin=admin)
def get_users(): users, _ = User.list_users(g.start, g.limit) private = bool(request.oauth.user.privilege) return [u.to_dict(private=private) for u in users if u], 200