#NEWLINE# def get_filename( self , filename , filesystem = False , convert = False , subpath = '' ) : #NEWLINE# #INDENT# "\n        Get the filename according to self.to_path, and if filesystem is False\n        then return unicode filename, otherwise return filesystem encoded filename\n    \n        @param filename: relative filename, it'll be combine with self.to_path\n        @param filesystem: if True, then encoding the filename to filesystem\n        @param convert: if True, then convert filename with FilenameConverter class\n        @param subpath: sub folder in to_path\n        " #NEWLINE# from uliweb.utils.common import safe_unicode #NEWLINE# s = settings . GLOBAL #NEWLINE# if convert : #NEWLINE# #INDENT# ( _p , _f ) = os . path . split ( filename ) #NEWLINE# _filename = os . path . join ( _p , self . filename_convert ( _f ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _filename = filename #NEWLINE# #UNINDENT# nfile = safe_unicode ( convert , s . HTMLPAGE_ENCODING ) #NEWLINE# if subpath : #NEWLINE# #INDENT# paths = [ application_path ( self . to_path ) , subpath , nfile ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# paths = [ application_path ( self . to_path ) , nfile ] #NEWLINE# #UNINDENT# f = os . path . normpath ( os . path . join ( * paths ) ) . replace ( '\\' , '/' ) #NEWLINE# if filesystem : #NEWLINE# #INDENT# return files . encode_filename ( f , to_encoding = s . FILESYSTEM_ENCODING ) #NEWLINE# #UNINDENT# return f