@app.route('/findhost')
@login_required
def findhost():
    """Just used for the type ahead"""
    # probably should cache hosts in memcached/redis for type ahead crap
    if not request.args.get('q'):
        abort(400)
    result = []
    for i in r.table("hosts").filter(
            r.row["hostname"].match(request.args.get('q') % "^%s") | r.row["ip"].match("^%s" % request.args.get('q'))
            ).pluck({"hostname": True, "ip": True}).run(rdb.conn):
        if i['hostname'].startswith(request.args.get('q')):
            result.append(i['hostname'])
        else:
            result.append(i['ip'])
    return ",".join(result)
dataset/ETHPy150Open pandemicsyn/stalker/stalkerweb/stalkerweb/views.py/findhost/swapped operands of `%`