#NEWLINE# def test_transient_invalid( self ) : #NEWLINE# #INDENT# illegal = [ 'more/../../../lost.txt' , '../pass' , '/etc/pass' , '..' , '~' ] #NEWLINE# for filename in illegal : #NEWLINE# #INDENT# form = FormWithFile ( self . env ) #NEWLINE# form . accept ( MultiDict ( { #NEWLINE# #INDENT# 'file.file' : None , #NEWLINE# 'file.original_name' : 'test.txt' , #NEWLINE# 'file.transient_name' : filename , #NEWLINE# 'file.mode' : 'transient' , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertIn ( 'file.transient_name' , form . errors , ( 'file name is not filtered: %s' % form ) )