<commit_before>#from django.http import Http404
#from mezzanine.pages.page_processors import processor_for
#from mezzanine.pages.models import Page
#from mezzanine.galleries.models import Gallery
from models import PageViewGroup

def can_access(user, page):
    """
    If the page has groups associated with it, the user
    must have access to the group
    """
    page_groups = PageViewGroup.objects.filter(page=page)
    groups = page_groups.filter(group__in=user.groups.all())
    return page_groups.count() == 0 or groups.count() > 0

"""
@processor_for(Page)
def page_view(request, page):
"""<commit_msg>Anonymous users should not see any pages that have any groups associated.<commit_after>#from django.http import Http404
#from mezzanine.pages.page_processors import processor_for
#from mezzanine.pages.models import Page
#from mezzanine.galleries.models import Gallery
from models import PageViewGroup

def can_access(user, page):
    """
    If the page has groups associated with it, the user
    must have access to the group
    """
    page_groups = PageViewGroup.objects.filter(page=page)
    if user.is_anonymous():
        return page_groups.count() == 0
    else:
        groups = page_groups.filter(group__in=user.groups.all())
    return page_groups.count() == 0 or groups.count > 0

"""
@processor_for(Page)
def page_view(request, page):
"""
{'fraction_non_alphanumeric': 0.09750733137829912, 'fraction_numerical': 0.008064516129032258, 'mean_word_length': 4.46, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4316571', 'n_tokens_mistral': 418, 'n_tokens_neox': 399, 'n_words': 123}