#NEWLINE# def _get_metadata( self , path , filename ) : #NEWLINE# #INDENT# metadata = read_metadata ( path ) #NEWLINE# if ( not self . validate_metadata ( metadata ) ) : #NEWLINE# #INDENT# raise BadRequestError ( ) #NEWLINE# #UNINDENT# if ( metadata . get ( Version . FILENAME ) not in [ None , filename ] ) : #NEWLINE# #INDENT# raise BadRequestError ( ) #NEWLINE# #UNINDENT# ( expected_name , expected_version ) = guess_name_and_version ( filename ) #NEWLINE# if ( ( metadata [ 'name' ] != expected_name ) or ( metadata [ 'version' ] != expected_version ) ) : #NEWLINE# #INDENT# self . logger . warn ( 'Aborting upload of: {}; conflicting filename and metadata' . format ( filename ) ) #NEWLINE# raise BadRequestError ( ) #NEWLINE# #UNINDENT# metadata [ Version . FILENAME ] = filename #NEWLINE# metadata [ '_uploaded_timestamp' ] = time ( ) #NEWLINE# return metadata