#NEWLINE# def _is_user_profile_visible( self , user = None ) : #NEWLINE# #INDENT# "Get whether or not a User's profile is viewable by a given user.\n\n    A profile is viewable if it's not marked as private, or the viewing\n    user owns the profile, or the user is a staff member.\n    " #NEWLINE# try : #NEWLINE# #INDENT# if hasattr ( self , 'is_private' ) : #NEWLINE# #INDENT# is_private = self . is_private #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# is_private = self . get_profile ( ) . is_private #NEWLINE# #UNINDENT# return ( ( user and ( ( user == is_private ) or user . is_staff ) ) or ( not is_private ) ) #NEWLINE# #UNINDENT# except Profile . DoesNotExist : #NEWLINE# #INDENT# return True