(key)
Perform some basic checks on a potential blob key

    This method makes a best-effort attempt to verify that the key is
    safe for all blob db backends. It will not necessarily detect all
    unsafe keys.

    :raises: BadName if key is unsafe.
Perform some basic checks on a potential blob key
Perform some basic checks on a potential blob key
def check_safe_key(key):
    """Perform some basic checks on a potential blob key

    This method makes a best-effort attempt to verify that the key is
    safe for all blob db backends. It will not necessarily detect all
    unsafe keys.

    :raises: BadName if key is unsafe.
    """
    if (key.startswith(("/", ".")) or
            "/../" in key or
            key.endswith("/..") or
            not SAFENAME.match(key)):
        raise BadName("unsafe key: %r" % key)
def check_safe_key ( key ) : if ( key . startswith ( ( "/" , "." ) ) or "/../" in key or key . endswith ( "/.." ) or not SAFENAME . match ( key ) ) : raise BadName ( "unsafe key: %r" % key )