def _profile_view(profile, is_profile=False): # TODO: Fix circular import from website.addons.badges.util import get_sorted_user_badges if profile and profile.is_disabled: raise HTTPError(http.GONE) if "badges" in settings.ADDONS_REQUESTED: badge_assertions = (get_sorted_user_badges(profile),) badges = _get_user_created_badges(profile) else: # NOTE: While badges, are unused, 'assertions' and 'badges' can be # empty lists. badge_assertions = [] badges = [] if profile: profile_user_data = profile_utils.serialize_user(profile, full=True, is_profile=is_profile) return { "profile": profile_user_data, "assertions": badge_assertions, "badges": badges, "user": { "is_profile": is_profile, "can_edit": None, # necessary for rendering nodes "permissions": [], # necessary for rendering nodes }, } raise HTTPError(http.NOT_FOUND)
def _profile_view(uid=None): # TODO: Fix circular import from website.addons.badges.util import get_sorted_user_badges user = get_current_user() profile = User.load(uid) if uid else user if not (uid or user): return redirect('/login/?next={0}'.format(request.path)) if 'badges' in settings.ADDONS_REQUESTED: badge_assertions = get_sorted_user_badges(profile), badges = _get_user_created_badges(profile) else: # NOTE: While badges, are unused, 'assertions' and 'badges' can be # empty lists. badge_assertions = [] badges = [] if profile: profile_user_data = profile_utils.serialize_user(profile, full=True) return { 'profile': profile_user_data, 'assertions': badge_assertions, 'badges': badges, 'user': { 'is_profile': user == profile, 'can_edit': None, # necessary for rendering nodes 'permissions': [], # necessary for rendering nodes }, } raise HTTPError(http.NOT_FOUND)
def _profile_view(profile, is_profile=False): # TODO: Fix circular import from website.addons.badges.util import get_sorted_user_badges if profile and profile.is_disabled: raise HTTPError(http.GONE) if 'badges' in settings.ADDONS_REQUESTED: badge_assertions = get_sorted_user_badges(profile), badges = _get_user_created_badges(profile) else: # NOTE: While badges, are unused, 'assertions' and 'badges' can be # empty lists. badge_assertions = [] badges = [] if profile: profile_user_data = profile_utils.serialize_user(profile, full=True, is_profile=is_profile) return { 'profile': profile_user_data, 'assertions': badge_assertions, 'badges': badges, 'user': { 'is_profile': is_profile, 'can_edit': None, # necessary for rendering nodes 'permissions': [], # necessary for rendering nodes }, } raise HTTPError(http.NOT_FOUND)
def _profile_view(profile, is_profile): # TODO: Fix circular import from website.addons.badges.util import get_sorted_user_badges if profile and profile.is_disabled: raise HTTPError(http.GONE) if 'badges' in settings.ADDONS_REQUESTED: badge_assertions = get_sorted_user_badges(profile), badges = _get_user_created_badges(profile) else: # NOTE: While badges, are unused, 'assertions' and 'badges' can be # empty lists. badge_assertions = [] badges = [] if profile: profile_user_data = profile_utils.serialize_user(profile, full=True) return { 'profile': profile_user_data, 'assertions': badge_assertions, 'badges': badges, 'user': { 'is_profile': is_profile, 'can_edit': None, # necessary for rendering nodes 'permissions': [], # necessary for rendering nodes }, } raise HTTPError(http.NOT_FOUND)