def profile_handler(response, username=None): if username is None: user_object = User.find(get_login(response)) else: user_object = User.find(username) if user_object is None: error_handler(response) return context = {} user_locations = Location.find_user_locations(user_object.id) context["results"] = user_locations context["user_object"] = user_object render_page("account.html", response, context)