#NEWLINE# def _SetWeb( self ) : #NEWLINE# #INDENT# 'Sets website configuration for a bucket.' #NEWLINE# main_page_suffix = None #NEWLINE# error_page = None #NEWLINE# if self . sub_opts : #NEWLINE# #INDENT# for ( o , a ) in self . sub_opts : #NEWLINE# #INDENT# if ( o == '-m' ) : #NEWLINE# #INDENT# main_page_suffix = a #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( o == '-e' ) : #NEWLINE# #INDENT# error_page = url_args #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# url_args = self . args #NEWLINE# website = apitools_messages . Bucket . WebsiteValue ( mainPageSuffix = main_page_suffix , notFoundPage = error_page ) #NEWLINE# some_matched = False #NEWLINE# for url_str in url_args : #NEWLINE# #INDENT# bucket_iter = self . GetBucketUrlIterFromArg ( url_str , bucket_fields = [ 'id' ] ) #NEWLINE# for blr in bucket_iter : #NEWLINE# #INDENT# url = blr . storage_url #NEWLINE# some_matched = True #NEWLINE# self . logger . info ( 'Setting website configuration on %s...' , blr ) #NEWLINE# bucket_metadata = apitools_messages . Bucket ( website = website ) #NEWLINE# self . gsutil_api . PatchBucket ( url . bucket_name , bucket_metadata , provider = url . scheme , fields = [ 'id' ] ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not some_matched ) : #NEWLINE# #INDENT# raise CommandException ( ( NO_URLS_MATCHED_TARGET % list ( url_args ) ) ) #NEWLINE# #UNINDENT# return 0