예제 #1
0
def updates():
    """ Check for updates in GitHub repo if more than an hour's passed """
    vals = {
        'last_updated': utils.sync_check(),
        'count': Address.query.count(),
        }
    return jsonify(vals)
예제 #2
0
def updates():
    """ Check for updates in GitHub repo if more than an hour's passed """
    vals = {
        'last_updated': utils.sync_check(),
        'count': Address.query.count(),
    }
    return jsonify(vals)
예제 #3
0
def index():
    """ Index page """
    count = Address.query.count()
    latest = utils.sync_check()
    form = SpammerForm()
    # try to validate, and check for AJAX submission
    if form.validate_on_submit():
            if not utils.check_if_exists(form.address.data):
                flash(
                    u"We've added %s to the database." % form.address.data,
                    "text-success")
            else:
                flash(
                    u"We already know about %s, though." % form.address.data,
                    "text-success")
    if request.is_xhr:
        # OK to send back a fragment
        return render_template('form.jinja', form=form)
    # GET or no JS, so render a full page
    return render_template('index.jinja', form=form, count=count, latest=latest)
예제 #4
0
def index():
    """ Index page """
    count = Address.query.count()
    latest = utils.sync_check()
    form = SpammerForm()
    # try to validate, and check for AJAX submission
    if form.validate_on_submit():
        if not utils.check_if_exists(form.address.data):
            flash(u"We've added %s to the database." % form.address.data,
                  "text-success")
        else:
            flash(u"We already know about %s, though." % form.address.data,
                  "text-success")
    if request.is_xhr:
        # OK to send back a fragment
        return render_template('form.jinja', form=form)
    # GET or no JS, so render a full page
    return render_template('index.jinja',
                           form=form,
                           count=count,
                           latest=latest)