Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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():
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 = {}
"""
# 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)
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:
"""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)
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