'Checks if the Mako template contains the page expression marking it as
safe by default.
Arguments:
mako_template: The contents of the Mako template.
results: A list of results into which violations will be added.
Side effect:
Adds violations regarding page default if necessary
Returns:
True if the template has the page default, and False otherwise.'

def _has_page_default(self, mako_template, results):

    page_tag_count = self._get_page_tag_count(mako_template)
    if (2 <= page_tag_count):
        results.violations.append(RuleViolation(Rules.mako_multiple_page_tags))
        return False
    elif (page_tag_count != 1):
        results.violations.append(RuleViolation(Rules.mako_missing_default))
        return False
    page_h_filter_regex = re.compile('<%page[^>]*expression_filter=(?:"h"|\'h\')[^>]*/>')
    page_match = page_h_filter_regex.search(mako_template)
    if (not page_match):
        results.violations.append(RuleViolation(Rules.mako_missing_default))
    return page_match
