@@ -296,7 +296,7 @@ def get_bucket(self, bucket_name):
296296 :returns: The bucket matching the name provided.
297297 :raises: :class:`gcloud.exceptions.NotFound`
298298 """
299- bucket = self . new_bucket ( bucket_name )
299+ bucket = Bucket ( connection = self , name = bucket_name )
300300 response = self .api_request (method = 'GET' , path = bucket .path )
301301 return Bucket (properties = response , connection = self )
302302
@@ -326,7 +326,7 @@ def lookup(self, bucket_name):
326326 except NotFound :
327327 return None
328328
329- def create_bucket (self , bucket ):
329+ def create_bucket (self , bucket_name ):
330330 """Create a new bucket.
331331
332332 For example::
@@ -337,34 +337,27 @@ def create_bucket(self, bucket):
337337 >>> print bucket
338338 <Bucket: my-bucket>
339339
340- :type bucket : string or :class:`gcloud.storage.bucket.Bucket`
341- :param bucket : The bucket name (or bucket object) to create.
340+ :type bucket_name : string
341+ :param bucket_name : The bucket name to create.
342342
343343 :rtype: :class:`gcloud.storage.bucket.Bucket`
344344 :returns: The newly created bucket.
345345 :raises: :class:`gcloud.exceptions.Conflict` if
346346 there is a confict (bucket already exists, invalid name, etc.)
347347 """
348- bucket = self .new_bucket (bucket )
349348 response = self .api_request (method = 'POST' , path = '/b' ,
350- data = {'name' : bucket . name })
349+ data = {'name' : bucket_name })
351350 return Bucket (properties = response , connection = self )
352351
353- def delete_bucket (self , bucket ):
352+ def delete_bucket (self , bucket_name ):
354353 """Delete a bucket.
355354
356- You can use this method to delete a bucket by name, or to delete
357- a bucket object::
355+ You can use this method to delete a bucket by name.
358356
359357 >>> from gcloud import storage
360358 >>> connection = storage.get_connection(project)
361359 >>> connection.delete_bucket('my-bucket')
362360
363- You can also delete pass in the bucket object::
364-
365- >>> bucket = connection.get_bucket('other-bucket')
366- >>> connection.delete_bucket(bucket)
367-
368361 If the bucket doesn't exist, this will raise a
369362 :class:`gcloud.exceptions.NotFound`::
370363
@@ -383,36 +376,11 @@ def delete_bucket(self, bucket):
383376 >>> except Conflict:
384377 >>> print 'That bucket is not empty!'
385378
386- :type bucket: string or :class:`gcloud.storage.bucket.Bucket`
387- :param bucket: The bucket name (or bucket object) to delete.
388- """
389- bucket = self .new_bucket (bucket )
390- self .api_request (method = 'DELETE' , path = bucket .path )
391-
392- def new_bucket (self , bucket ):
393- """Factory method for creating a new (unsaved) bucket object.
394-
395- This method is really useful when you're not sure whether you
396- have an actual :class:`gcloud.storage.bucket.Bucket` object or
397- just a name of a bucket. It always returns the object::
398-
399- >>> bucket = connection.new_bucket('bucket')
400- >>> print bucket
401- <Bucket: bucket>
402- >>> bucket = connection.new_bucket(bucket)
403- >>> print bucket
404- <Bucket: bucket>
405-
406- :type bucket: string or :class:`gcloud.storage.bucket.Bucket`
407- :param bucket: A name of a bucket or an existing Bucket object.
379+ :type bucket_name: string
380+ :param bucket_name: The bucket name to delete.
408381 """
409- if isinstance (bucket , Bucket ):
410- return bucket
411-
412- if isinstance (bucket , six .string_types ):
413- return Bucket (connection = self , name = bucket )
414-
415- raise TypeError ('Invalid bucket: %s' % bucket )
382+ bucket_path = '/b/' + bucket_name
383+ self .api_request (method = 'DELETE' , path = bucket_path )
416384
417385
418386class _BucketIterator (Iterator ):
0 commit comments