#NEWLINE# def copy_test_to_media( module , name ) : #NEWLINE# #INDENT# "\n    Copies a file from Mezzanine's test data path to MEDIA_ROOT.\n    Used in tests and demo fixtures.\n    " #NEWLINE# mezzanine_path = path_for_import ( module ) #NEWLINE# test_path = os . path . join ( mezzanine_path , 'static' , 'test' , name ) #NEWLINE# to_path = os . path . join ( settings . MEDIA_ROOT , name ) #NEWLINE# to_dir = os . path . dirname ( to_path ) #NEWLINE# if ( not os . path . exists ( to_dir ) ) : #NEWLINE# #INDENT# os . makedirs ( name ) #NEWLINE# #UNINDENT# if os . path . isdir ( test_path ) : #NEWLINE# #INDENT# copy = copytree #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# copy = copyfile #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# copy ( test_path , to_path ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# pass