Ejemplo n.º 1
0
def _validate_cookie_def(c_def):
    """Validate the cookie definitions in the schema

    Validations performed:
        cannot contain delimiters we use on the client side
        values must match the valType if provided
        timeout must be numeric if provided

    Args:
        data (pkcollections.Dict): cookie definition object from the schema
    """
    c_delims = '|:;='
    c_delim_re = re.compile('[{}]'.format(c_delims))
    if c_delim_re.search(str(c_def.name) + str(c_def.value)):
        raise AssertionError(util.err(c_def, 'cookie name/value cannot include delimiters {}', c_delims))
    if 'valType' in c_def:
        if c_def.valType == 'b':
            pkconfig.parse_bool(c_def.value)
        if c_def.valType == 'n':
            float(c_def.value)
    if 'timeout' in c_def:
        float(c_def.timeout)
Ejemplo n.º 2
0
def _validate_cookie_def(c_def):
    """Validate the cookie definitions in the schema

    Validations performed:
        cannot contain delimiters we use on the client side
        values must match the valType if provided
        timeout must be numeric if provided

    Args:
        data (pkcollections.Dict): cookie definition object from the schema
    """
    c_delims = '|:;='
    c_delim_re = re.compile('[{}]'.format(c_delims))
    if c_delim_re.search(str(c_def.name) + str(c_def.value)):
        raise AssertionError(util.err(c_def, 'cookie name/value cannot include delimiters {}', c_delims))
    if 'valType' in c_def:
        if c_def.valType == 'b':
            pkconfig.parse_bool(c_def.value)
        if c_def.valType == 'n':
            float(c_def.value)
    if 'timeout' in c_def:
        float(c_def.timeout)