...
|
...
|
@@ -324,34 +324,34 @@ def check_bucket_name(bucket, dns_strict = True):
|
324
|
324
|
if dns_strict:
|
325
|
325
|
invalid = re.search("([^a-z0-9\.-])", bucket)
|
326
|
326
|
if invalid:
|
327
|
|
- raise ParameterError("Bucket name '%s' contains disallowed character '%s'. The only supported ones are: lowercase us-ascii letters (a-z), digits (0-9), dot (.) and hyphen (-)." % (bucket, invalid.groups()[0]))
|
|
327
|
+ raise Exceptions.ParameterError("Bucket name '%s' contains disallowed character '%s'. The only supported ones are: lowercase us-ascii letters (a-z), digits (0-9), dot (.) and hyphen (-)." % (bucket, invalid.groups()[0]))
|
328
|
328
|
else:
|
329
|
329
|
invalid = re.search("([^A-Za-z0-9\._-])", bucket)
|
330
|
330
|
if invalid:
|
331
|
|
- raise ParameterError("Bucket name '%s' contains disallowed character '%s'. The only supported ones are: us-ascii letters (a-z, A-Z), digits (0-9), dot (.), hyphen (-) and underscore (_)." % (bucket, invalid.groups()[0]))
|
|
331
|
+ raise Exceptions.ParameterError("Bucket name '%s' contains disallowed character '%s'. The only supported ones are: us-ascii letters (a-z, A-Z), digits (0-9), dot (.), hyphen (-) and underscore (_)." % (bucket, invalid.groups()[0]))
|
332
|
332
|
|
333
|
333
|
if len(bucket) < 3:
|
334
|
|
- raise ParameterError("Bucket name '%s' is too short (min 3 characters)" % bucket)
|
|
334
|
+ raise Exceptions.ParameterError("Bucket name '%s' is too short (min 3 characters)" % bucket)
|
335
|
335
|
if len(bucket) > 255:
|
336
|
|
- raise ParameterError("Bucket name '%s' is too long (max 255 characters)" % bucket)
|
|
336
|
+ raise Exceptions.ParameterError("Bucket name '%s' is too long (max 255 characters)" % bucket)
|
337
|
337
|
if dns_strict:
|
338
|
338
|
if len(bucket) > 63:
|
339
|
|
- raise ParameterError("Bucket name '%s' is too long (max 63 characters)" % bucket)
|
|
339
|
+ raise Exceptions.ParameterError("Bucket name '%s' is too long (max 63 characters)" % bucket)
|
340
|
340
|
if re.search("-\.", bucket):
|
341
|
|
- raise ParameterError("Bucket name '%s' must not contain sequence '-.' for DNS compatibility" % bucket)
|
|
341
|
+ raise Exceptions.ParameterError("Bucket name '%s' must not contain sequence '-.' for DNS compatibility" % bucket)
|
342
|
342
|
if re.search("\.\.", bucket):
|
343
|
|
- raise ParameterError("Bucket name '%s' must not contain sequence '..' for DNS compatibility" % bucket)
|
|
343
|
+ raise Exceptions.ParameterError("Bucket name '%s' must not contain sequence '..' for DNS compatibility" % bucket)
|
344
|
344
|
if not re.search("^[0-9a-z]", bucket):
|
345
|
|
- raise ParameterError("Bucket name '%s' must start with a letter or a digit" % bucket)
|
|
345
|
+ raise Exceptions.ParameterError("Bucket name '%s' must start with a letter or a digit" % bucket)
|
346
|
346
|
if not re.search("[0-9a-z]$", bucket):
|
347
|
|
- raise ParameterError("Bucket name '%s' must end with a letter or a digit" % bucket)
|
|
347
|
+ raise Exceptions.ParameterError("Bucket name '%s' must end with a letter or a digit" % bucket)
|
348
|
348
|
return True
|
349
|
349
|
__all__.append("check_bucket_name")
|
350
|
350
|
|
351
|
351
|
def check_bucket_name_dns_conformity(bucket):
|
352
|
352
|
try:
|
353
|
353
|
return check_bucket_name(bucket, dns_strict = True)
|
354
|
|
- except ParameterError:
|
|
354
|
+ except Exceptions.ParameterError:
|
355
|
355
|
return False
|
356
|
356
|
__all__.append("check_bucket_name_dns_conformity")
|
357
|
357
|
|