<commit_before>from mezzanine.pages.page_processors import processor_for
from .models import PageForPages, RichTextPageForPages, PageInPage

def opd_processor(request, page):
    """
    processor for "One-page design" container pages,
    which means instances of PageForPages and RichTextPageForPages
    classes.
    
    """
    subpages = []
    for page in page.children.all():
        subpage = page.get_content_model()
        if isinstance(subpage, PageInPage):
            subpages.append(subpage)
    return {"subpages": subpages, "page": page, "request": request}

@processor_for(PageForPages)
def simple_opd_processor(request, page):
    return opd_processor(request, page)

@processor_for(RichTextPageForPages)
def rich_opd_processor(request, page):
    return opd_processor(request, page)

@processor_for(PageInPage)
def dumb_processor(request, page):
    # We don't need no processing, since it has
    # been handled by OnePageDesign processor.
    pass

<commit_msg>fix page_processor returning all pages instead of published ones<commit_after>from mezzanine.pages.page_processors import processor_for
from .models import PageForPages, RichTextPageForPages, PageInPage

def opd_processor(request, page):
    """
    processor for "One-page design" container pages,
    which means instances of PageForPages and RichTextPageForPages
    classes.
    
    """
    subpages = []
    for page in page.children.published():
        subpage = page.get_content_model()
        if isinstance(subpage, PageInPage):
            subpages.append(subpage)
    return {"subpages": subpages, "page": page, "request": request}

@processor_for(PageForPages)
def simple_opd_processor(request, page):
    return opd_processor(request, page)

@processor_for(RichTextPageForPages)
def rich_opd_processor(request, page):
    return opd_processor(request, page)

@processor_for(PageInPage)
def dumb_processor(request, page):
    # We don't need no processing, since it has
    # been handled by OnePageDesign processor.
    pass


{'fraction_non_alphanumeric': 0.08592592592592592, 'fraction_numerical': 0.0, 'mean_word_length': 4.374005305039788, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, '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': '6243941', 'n_tokens_mistral': 593, 'n_tokens_neox': 587, 'n_words': 162}