def add_alert_for_uri_check_with_id(self, uri_check_id=1, target_email='*****@*****.**', num_of_times = 1, num_of_times_alerted=0): alert = Alert() alert.check_id = uri_check_id alert.target = target_email alert.num_of_times = num_of_times alert.num_of_times_alerted = num_of_times_alerted self.cur_session.add(alert) self.cur_session.flush()
def add_check_and_alert(): check = create_or_get_uri_check(g.db, request.form['Url']) if check == None: flash('Invalid Url', 'error') return redirect(url_for('index', Url=request.form['Url'], Email=request.form['Email'], AlertTimes=request.form['AlertTimes'])) alert = Alert() alert.check_id = check.check_id alert.check = check alert.target = request.form['Email'] alert.num_of_times = request.form['AlertTimes'] alert.alert_type = get_alert_type(request.form['Email']) g.db.add(alert) flash('Created Alert!', 'success') res = make_response(redirect(url_for('index'))) res.set_cookie('email', request.form['Email']) return res