@app.route('/<username>')
def user_timeline(username):
 profile_user = query_db('select * from user where username = ?', [username], one=True)
 if (profile_user is None):
  abort(404)
 followed = False
 if g.user:
  followed = (query_db('select 1 from follower where\n            follower.who_id = ? and follower.whom_id = ?', [session['user_id'], profile_user['user_id']], one=True) is not None)
 return render_template('timeline.html', messages=query_db('\n            select message.*, user.* from message, user where\n            user.user_id = message.author_id and user.user_id = ?\n            order by message.pub_date desc limit ?', [profile_user['user_id'], PER_PAGE]), followed=followed, profile_user=profile_user)

@ app . route ( '/<username>' ) def user_timeline ( username ) : profile_user = query_db ( 'select * from user where username = ?' , [ username ] , one = True ) if ( profile_user is None ) : abort ( 404 ) followed = False if g . user : followed = ( query_db ( 'select 1 from follower where\n            follower.who_id = ? and follower.whom_id = ?' , [ session [ 'user_id' ] , profile_user [ 'user_id' ] ] , one = True ) is not None ) return render_template ( 'timeline.html' , messages = query_db ( '\n            select message.*, user.* from message, user where\n            user.user_id = message.author_id and user.user_id = ?\n            order by message.pub_date desc limit ?' , [ profile_user [ 'user_id' ] , PER_PAGE ] ) , followed = followed , profile_user = profile_user )
displays a users tweets .