@app.route('/login/lms/', methods=['GET', 'POST'])
def login_lms():
    """Login screen for application"""
    DEFAULT_NEXT = url_for('lms_admin.index')
    next = request.args.get('next', DEFAULT_NEXT)

    lmss = [ lt for lt in LearningTool.all() if len(lt.shindig_credentials) == 0 ]

    if request.method == 'GET':
        return render_template('login_lms.html', next=next, lmss=lmss, action_url = url_for('login_lms'))
    if request.method == 'POST' and request.form in 'username':
        username = request.form['username']
        hashed = unicode(new_hash("sha", request.form['password'].encode('utf8')).hexdigest())
        lms_id = request.form['lms']
        user = LtUser.exists(username, hashed, lms_id)
        if user is not None:
            if login_user(user):
                session['loggeduser'] = username
                session['last_request'] = time()
                session['usertype'] = 'lms'
                if next == DEFAULT_NEXT:
                    if user.access_level == 'instructor':
                        next = url_for('lms_instructor.index')
                return redirect(next)
            else:
                flash(gettext(u'Could not log in.'))
                return render_template('login_lms.html', next=next, lmss=lmss, action_url = url_for('login_lms'))
        else:
            flash(gettext(u'Invalid username.'))
            return render_template('login_lms.html', next=next, lmss=lmss, action_url = url_for('login_lms'))
    return gettext("Error in create_session")
dataset/ETHPy150Open gateway4labs/labmanager/labmanager/views/authn.py/login_lms/swapped operands of `in`