How to use the diazo.compiler.quote_param 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 / plone.app.theming / src / plone / app / theming / utils.py View on Github external
def prepareThemeParameters(context, request, parameterExpressions, cache=None):
    """Prepare and return a dict of parameter expression values.
    """

    # Find real or virtual path - PATH_INFO has VHM elements in it
    url = request.get('ACTUAL_URL', '')

    # Find the host name
    base = request.get('BASE1', '')
    path = url[len(base):]
    parts = urlsplit(base.lower())

    params = dict(
        url=quote_param(url),
        base=quote_param(base),
        path=quote_param(path),
        scheme=quote_param(parts.scheme),
        host=quote_param(parts.netloc),
    )

    # Add expression-based parameters
    if not parameterExpressions:
        return params

    # Compile and cache expressions
    expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
        expressions = {}
        for name, expressionText in parameterExpressions.items():
github plone / plone.app.theming / src / plone / app / theming / utils.py View on Github external
def prepareThemeParameters(context, request, parameterExpressions, cache=None):
    """Prepare and return a dict of parameter expression values.
    """

    # Find real or virtual path - PATH_INFO has VHM elements in it
    url = request.get('ACTUAL_URL', '')

    # Find the host name
    base = request.get('BASE1', '')
    path = url[len(base):]
    parts = urlsplit(base.lower())

    params = dict(
        url=quote_param(url),
        base=quote_param(base),
        path=quote_param(path),
        scheme=quote_param(parts.scheme),
        host=quote_param(parts.netloc),
    )

    # Add expression-based parameters
    if not parameterExpressions:
        return params

    # Compile and cache expressions
    expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
        expressions = {}
github plone / plone.app.theming / src / plone / app / theming / utils.py View on Github external
"""

    # Find real or virtual path - PATH_INFO has VHM elements in it
    url = request.get('ACTUAL_URL', '')

    # Find the host name
    base = request.get('BASE1', '')
    path = url[len(base):]
    parts = urlsplit(base.lower())

    params = dict(
        url=quote_param(url),
        base=quote_param(base),
        path=quote_param(path),
        scheme=quote_param(parts.scheme),
        host=quote_param(parts.netloc),
    )

    # Add expression-based parameters
    if not parameterExpressions:
        return params

    # Compile and cache expressions
    expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
        expressions = {}
        for name, expressionText in parameterExpressions.items():
            expressions[name] = compileExpression(expressionText)
github plone / plone.app.theming / src / plone / app / theming / utils.py View on Github external
def prepareThemeParameters(context, request, parameterExpressions, cache=None):
    """Prepare and return a dict of parameter expression values.
    """

    # Find real or virtual path - PATH_INFO has VHM elements in it
    url = request.get('ACTUAL_URL', '')

    # Find the host name
    base = request.get('BASE1', '')
    path = url[len(base):]
    parts = urlsplit(base.lower())

    params = dict(
        url=quote_param(url),
        base=quote_param(base),
        path=quote_param(path),
        scheme=quote_param(parts.scheme),
        host=quote_param(parts.netloc),
    )

    # Add expression-based parameters
    if not parameterExpressions:
        return params

    # Compile and cache expressions
    expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
github plone / plone.app.theming / src / plone / app / theming / utils.py View on Github external
"""Prepare and return a dict of parameter expression values.
    """

    # Find real or virtual path - PATH_INFO has VHM elements in it
    url = request.get('ACTUAL_URL', '')

    # Find the host name
    base = request.get('BASE1', '')
    path = url[len(base):]
    parts = urlsplit(base.lower())

    params = dict(
        url=quote_param(url),
        base=quote_param(base),
        path=quote_param(path),
        scheme=quote_param(parts.scheme),
        host=quote_param(parts.netloc),
    )

    # Add expression-based parameters
    if not parameterExpressions:
        return params

    # Compile and cache expressions
    expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
        expressions = {}
        for name, expressionText in parameterExpressions.items():
            expressions[name] = compileExpression(expressionText)
github plone / plone.app.theming / src / plone / app / theming / utils.py View on Github external
expressions = None
    if cache is not None:
        expressions = cache.expressions

    if expressions is None:
        expressions = {}
        for name, expressionText in parameterExpressions.items():
            expressions[name] = compileExpression(expressionText)

        if cache is not None:
            cache.updateExpressions(expressions)

    # Execute all expressions
    expressionContext = createExpressionContext(context, request)
    for name, expression in expressions.items():
        params[name] = quote_param(expression(expressionContext))

    return params