#NEWLINE# def put( self , bucket , object_name ) : #NEWLINE# #INDENT# object_name = urllib . unquote ( object_name ) #NEWLINE# bucket_dir = os . path . abspath ( os . path . join ( self . application . directory , path ) ) #NEWLINE# if ( ( not bucket_dir . startswith ( self . application . directory ) ) or ( not os . path . isdir ( bucket_dir ) ) ) : #NEWLINE# #INDENT# raise web . HTTPError ( 404 ) #NEWLINE# #UNINDENT# path = self . _object_path ( bucket , object_name ) #NEWLINE# if ( ( not path . startswith ( bucket_dir ) ) or os . path . isdir ( path ) ) : #NEWLINE# #INDENT# raise web . HTTPError ( 403 ) #NEWLINE# #UNINDENT# directory = os . path . dirname ( path ) #NEWLINE# if ( not os . path . exists ( directory ) ) : #NEWLINE# #INDENT# os . makedirs ( directory ) #NEWLINE# #UNINDENT# object_file = open ( path , 'w' ) #NEWLINE# object_file . write ( self . request . body ) #NEWLINE# object_file . close ( ) #NEWLINE# self . object_file_name = path #NEWLINE# self . set_etag_header ( ) #NEWLINE# self . set_header ( 'x-amz-server-side-encryption-customer-algorithm' , 'testing' ) #NEWLINE# self . finish ( )