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
utils.py: is_uuid_like(val) is incorrect. A value of "12345678901234 56789012" 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):
acceptable = "0123456789abcd efABCDEF"
"""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.
return not bool([ch for ch in val if ch not in acceptable])
return False