G
G
German Jet2015-02-05 13:06:54
Flask
German Jet, 2015-02-05 13:06:54

What does expected string or Unicode object, long found mean?

Site on Flask, when authorizing (Flask-Login) an error appears in the logs:

TypeError: expected string or Unicode object, long found

Here is the code:
from flask.ext.login import login_user, logout_user, current_user, login_required

def main():
    form = LoginForm()
    if form.validate_on_submit():
        username = request.form['username']
        password = request.form['password']
        user = User.query.filter_by(username=username, password=password).first()
        if user is None:
            flash('Login or Password is invalid', 'error')
            return redirect("/")
        login_user(user)
        return redirect("/")
    news = News.query.order_by(News.putdate.desc()).limit(3)
    return render_template("main/main.html", 
        news= news,
        form = form)


Everything works on the local machine, problems only on the server

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
German Jet, 2015-02-08
@GeraJet

The problem was solved by removing flask, sqlalchemy, flask-sqlalchemy and installing specific versions (not the latest) flask==0.9, sqlalchemy==0.7.9, flask-sqlalchemy==0.16

A
Alexey, 2015-02-06
@rdifb0

Means that the python expects a string, and it is given a number (integer). Maybe there is a concatenation curve somewhere inside login_user ()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question