diff --git a/gcloud/storage/bucket.py b/gcloud/storage/bucket.py index edb0e7e4b577..f2def041e549 100644 --- a/gcloud/storage/bucket.py +++ b/gcloud/storage/bucket.py @@ -128,13 +128,25 @@ def connection(self): """ return self._connection + @staticmethod + def path_helper(bucket_name): + """Relative URL path for a bucket. + + :type bucket_name: string + :param bucket_name: The bucket name in the path. + + :rtype: string + :returns: The relative URL path for ``bucket_name``. + """ + return '/b/' + bucket_name + @property def path(self): """The URL path to this bucket.""" if not self.name: raise ValueError('Cannot determine path without bucket name.') - return '/b/' + self.name + return self.path_helper(self.name) def get_blob(self, blob): """Get a blob object by name. diff --git a/gcloud/storage/connection.py b/gcloud/storage/connection.py index 46eb40564e97..54e83d532261 100644 --- a/gcloud/storage/connection.py +++ b/gcloud/storage/connection.py @@ -462,7 +462,7 @@ def delete_bucket(self, bucket_name): :type bucket_name: string :param bucket_name: The bucket name to delete. """ - bucket_path = '/b/' + bucket_name + bucket_path = Bucket.path_helper(bucket_name) self.api_request(method='DELETE', path=bucket_path) def generate_signed_url(self, resource, expiration,