Browse code

* S3/Utils.py, S3/S3Uri.py: Fixed names after moving functions between modules.

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@419 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2010/07/07 21:35:29
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+2010-07-08  Michal Ludvig  <mludvig@logix.net.nz>
2
+
3
+	* S3/Utils.py, S3/S3Uri.py: Fixed names after moving 
4
+	  functions between modules.
5
+
1 6
 2010-06-29  Timothee Groleau <kde@timotheegroleau.com>
2 7
 
3 8
 	* S3/ACL.py: Fix isAnonRead method on Grantees
... ...
@@ -9,7 +9,7 @@ import sys
9 9
 from BidirMap import BidirMap
10 10
 from logging import debug
11 11
 import S3
12
-from Utils import unicodise
12
+from Utils import unicodise, check_bucket_name_dns_conformity
13 13
 
14 14
 class S3Uri(object):
15 15
 	type = None
... ...
@@ -73,7 +73,7 @@ class S3UriS3(S3Uri):
73 73
 		return "/".join(["s3:/", self._bucket, self._object])
74 74
 	
75 75
 	def is_dns_compatible(self):
76
-		return S3.S3.check_bucket_name_dns_conformity(self._bucket)
76
+		return check_bucket_name_dns_conformity(self._bucket)
77 77
 
78 78
 	def public_url(self):
79 79
 		if self.is_dns_compatible():
... ...
@@ -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