How to use the diazo.utils.fullname function in diazo

To help you get started, we’ve selected a few diazo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plone / diazo / lib / diazo / rules.py View on Github external
read_network=False,
):
    if not read_network and \
            isinstance(theme, string_types) and \
            theme[:6] in ('ftp://', 'http:/', 'https:'):
        raise ValueError(
            "Supplied theme '{theme}', but network access denied.".format(
                theme=theme,
            ),
        )
    if absolute_prefix is None:
        absolute_prefix = ''
    if parser is None:
        parser = etree.HTMLParser()
    root = rules_doc.getroot()
    element = root.makeelement(fullname(namespaces['diazo'], 'theme'))
    root.append(element)
    theme_doc = etree.parse(theme, parser=parser)
    expand_theme(element, theme_doc, absolute_prefix)
    return rules_doc
github plone / diazo / lib / diazo / rules.py View on Github external
def add_identifiers(rules_doc):
    """Add identifiers to the rules for debugging"""
    for index, elem in enumerate(
        rules_doc.xpath(
            '//diazo:rules | //diazo:rules/diazo:*'
            ' | //old1:rules | //old1:rules/old1:*'
            ' | //old2:rules | //old2:rules/old1:*',
            namespaces=namespaces,
        ),
    ):
        elem.set(
            fullname(
                namespaces['xml'],
                'id',
            ),
            'r{index}'.format(index=index),
        )
    return rules_doc