¡@

Home 

OpenStack Study: uuidutils.py

OpenStack Index

**** CubicPower OpenStack Study ****

def generate_uuid():

    return str(uuid.uuid4())

**** CubicPower OpenStack Study ****

def is_uuid_like(val):

    """Returns validation of a value as a UUID.

    For our purposes, a UUID is a canonical form string:

    aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

    """

    try:

        return str(uuid.UUID(val)) == val

    except (TypeError, ValueError, AttributeError):

        return False