@cache_permission
def can_vote_suggestion(user, translation):
 if (not translation.subproject.suggestion_voting):
  return False
 if translation.subproject.locked:
  return False
 project = translation.subproject.project
 if check_owner(user, project, 'trans.vote_suggestion'):
  return True
 if (not has_group_perm(user, 'trans.vote_suggestion', translation)):
  return False
 if (translation.is_template() and (not has_group_perm(user, 'trans.save_template', translation))):
  return False
 return True

@ cache_permission def can_vote_suggestion ( user , translation ) : if ( not translation . subproject . suggestion_voting ) : return False if translation . subproject . locked : return False project = translation . subproject . project if check_owner ( user , project , 'trans.vote_suggestion' ) : return True if ( not has_group_perm ( user , 'trans.vote_suggestion' , translation ) ) : return False if ( translation . is_template ( ) and ( not has_group_perm ( user , 'trans.save_template' , translation ) ) ) : return False return True
checks whether user can vote suggestions on given translation .