Code review comment for lp:~rconradharris/nova/uuid-redux

Revision history for this message
Ed Leafe (ed-leafe) wrote :

utils.py: is_uuid_like(val) is incorrect. A value of "1234567890123456789012" is a perfectly legitimate UUID hex string, but that method will return False for this. I would recommend using the version I wrote:

def is_uuid(val):
    """Returns True if the value passed is a valid UUID string."""
    if isinstance(val, basestring):
        # Remove any dashes
        val = val.replace("-", "")
        # UUIDs are 32 hex characters long
        if len(val) == 32:
            # Make sure that they are all valid hex characters.
            acceptable = "0123456789abcdefABCDEF"
            return not bool([ch for ch in val if ch not in acceptable])
    return False

review: Needs Fixing

« Back to merge proposal