def check_stats_permission(request, addon, for_contributions=False):
 if (addon.public_stats and (not for_contributions)):
  return
 if (not request.user.is_authenticated()):
  raise PermissionDenied
 if (not for_contributions):
  if (addon.has_author(request.user) or acl.action_allowed(request, 'Stats', 'View')):
   return
 elif (addon.has_author(request.user) or acl.action_allowed(request, 'RevenueStats', 'View')):
  return
 raise PermissionDenied

def check_stats_permission ( request , addon , for_contributions = False ) : if ( addon . public_stats and ( not for_contributions ) ) : return if ( not request . user . is_authenticated ( ) ) : raise PermissionDenied if ( not for_contributions ) : if ( addon . has_author ( request . user ) or acl . action_allowed ( request , 'Stats' , 'View' ) ) : return elif ( addon . has_author ( request . user ) or acl . action_allowed ( request , 'RevenueStats' , 'View' ) ) : return raise PermissionDenied
check if user is allowed to view stats for addon .