def profile(): if 'login' in request.args and session.get('logged_in') is not None and session.get('logged_in') != request.args['login']: session.pop('logged_in', None) if session.get('logged_in') is None: if 'login' not in request.args: return redirect(url_for('PetCare.login')) else: return redirect(url_for('PetCare.prompt_login', userId=request.args['login'], targetId=request.args['userId'].rstrip())) accountDao = AccountDao() postDao = PostDao() accountInfo = accountDao.get_account_info(request.args['userId'].rstrip()) posts = postDao.get_user_posts(request.args['userId'].rstrip()) postInfos = [Entities.make_post_output(dict(post)) for post in posts] myCurrentPostId = accountDao.get_account_post(session['logged_in'].rstrip()) status = 'UNRELATED' if myCurrentPostId is None else postDao.check_relation(myCurrentPostId, request.args['userId'].rstrip()) return render_template('profile.html', account=accountInfo, posts=postInfos, status=status)
def profile(): if 'login' in request.args and session.get( 'logged_in' ) is not None and session.get('logged_in') != request.args['login']: session.pop('logged_in', None) if session.get('logged_in') is None: if 'login' not in request.args: return redirect(url_for('PetCare.login')) else: return redirect( url_for('PetCare.prompt_login', userId=request.args['login'], targetId=request.args['userId'])) accountDao = AccountDao() postDao = PostDao() accountInfo = accountDao.get_account_info(request.args['userId']) posts = postDao.get_user_posts(request.args['userId']) myCurrentPostId = accountDao.get_account_post(session['logged_in']) isInterested = False if myCurrentPostId is None else postDao.check_interested( myCurrentPostId, request.args['userId']) return render_template('profile.html', account=accountInfo, posts=posts, isInterested=isInterested)