#NEWLINE# def create_bucket( self , bucket_name , headers = None , location = Location . DEFAULT , policy = None , callback = None ) : #NEWLINE# #INDENT# "\n        Creates a new located bucket. By default it's in the USA. You can pass\n        Location.EU to create an European bucket.\n\n        :type bucket_name: string\n        :param bucket_name: The name of the new bucket\n        \n        :type headers: dict\n        :param headers: Additional headers to pass along with the request to AWS.\n\n        :type location: :class:`boto.s3.connection.Location`\n        :param location: The location of the new bucket\n        \n        :type policy: :class:`boto.s3.acl.CannedACLStrings`\n        :param policy: A canned ACL policy that will be applied to the new key in S3.\n             \n        " #NEWLINE# check_lowercase_bucketname ( bucket_name ) #NEWLINE# if policy : #NEWLINE# #INDENT# if headers : #NEWLINE# #INDENT# headers [ self . provider . acl_header ] = policy #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# headers = { #NEWLINE# #INDENT# self . provider . acl_header : policy , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# if ( location == Location . DEFAULT ) : #NEWLINE# #INDENT# data = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data = ( ( '<CreateBucketConstraint><LocationConstraint>' + self ) + '</LocationConstraint></CreateBucketConstraint>' ) #NEWLINE# #UNINDENT# def bucket_created( response ) : #NEWLINE# #INDENT# body = response . read ( ) #NEWLINE# if ( response . status == 409 ) : #NEWLINE# #INDENT# raise self . provider . storage_create_error ( response . status , response . reason , body ) #NEWLINE# #UNINDENT# if ( response . status == 200 ) : #NEWLINE# #INDENT# if callable ( callback ) : #NEWLINE# #INDENT# callback ( self . bucket_class ( self , bucket_name ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise self . provider . storage_response_error ( response . status , response . reason , body ) #NEWLINE# #UNINDENT# #UNINDENT# self . make_request ( 'PUT' , bucket_name , headers = headers , data = data , callback = bucket_created )