@app.route('/user', methods=['POST'])
@app.route('/user/<name>', methods=['GET'])
def user(name=None, message=''):
    name = (name or request.values['user_name'])
    try:
        if (request.method == 'POST'):
            add_or_update_user(name)
            message = 'User {} sucessfully added!'.format(name)
        tweets = User.query.filter((User.name == name)).one().tweets
    except Exception as e:
        message = 'Error handling {}: {}'.format(name, e)
        tweets = []
    return render_template('user.html', title=name, tweets=tweets, message=message)
@app.route('/user', methods=['POST'])
@app.route('/user/<name>', methods=['GET'])
def user(name=None, message=):
    name = (name or request.values['user_name'])
    try:
        if (request.method == 'POST'):
            add_or_update_user(name)
            message = 'User {} sucessfully added!'.format(name)
        tweets = User.query.filter((User.name == name)).one().tweets
    except Exception as e:
        message = 'Error handling {}: {}'.format(name, e)
        tweets = []
    return render_template('user.html', title=name, tweets=tweets, message=message)