示例#1
0
 def __instancecheck__(cls, instance):
     try:
         int(instance)
     except (ValueError, TypeError):
         return (isinstance(instance, six.string_types)
                 and uuidutils.is_uuid_like(instance))
     return (isinstance(instance, six.integer_types + six.string_types)
             and type(instance) != bool)
示例#2
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])
    if entry.startswith(su.SWIFT_INTERNAL_PREFIX):
        #TODO(tmckay):allow su.SWIFT_EXTERNAL_PREFIX in a future version
        #TODO(nprivalova):add hostname validation
        return True
    return False
示例#3
0
 def __instancecheck__(cls, instance):
     try:
         int(instance)
     except (ValueError, TypeError):
         return (isinstance(instance, six.string_types)
                 and uuidutils.is_uuid_like(instance))
     return (isinstance(instance, six.integer_types + six.string_types)
             and type(instance) != bool)
示例#4
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])
    if (entry.startswith('swift-internal://') or
            entry.startswith('swift-external://')):
        #TODO(nprivalova):add hostname validation
        return True
    return False
示例#5
0
def validate_job_location_format(entry):
    if entry.startswith('savanna-db://'):
        return uuidutils.is_uuid_like(entry[len("savanna-db://"):])

    # TODO(mattf): remove support for OLD_SWIFT_INTERNAL_PREFIX
    if entry.startswith(su.SWIFT_INTERNAL_PREFIX) or (entry.startswith(
            su.OLD_SWIFT_INTERNAL_PREFIX)):
        #TODO(nprivalova):add hostname validation
        return True
    return False
示例#6
0
文件: base.py 项目: hguemar/sahara
    def assertIsValidModelObject(self, res):
        self.assertIsNotNone(res)
        self.assertIsNotNone(res.dict)
        self.assertTrue(uuidutils.is_uuid_like(res.id))

        # check created/updated
        delta = datetime.timedelta(seconds=15)
        now = timeutils.utcnow()

        self.assertAlmostEqual(res.created, now, delta=delta)
        self.assertAlmostEqual(res.updated, now, delta=delta)
示例#7
0
    def assertIsValidModelObject(self, res):
        self.assertIsNotNone(res)
        self.assertIsNotNone(res.dict)
        self.assertTrue(uuidutils.is_uuid_like(res.id))

        # check created/updated
        delta = datetime.timedelta(seconds=15)
        now = timeutils.utcnow()

        self.assertAlmostEqual(res.created, now, delta=delta)
        self.assertAlmostEqual(res.updated, now, delta=delta)
示例#8
0
def validate_uuid_format(entry):
    return uuidutils.is_uuid_like(entry)
示例#9
0
def validate_uuid_format(entry):
    return uuidutils.is_uuid_like(entry)