def write( self, article ): from cleaner import schema parsed = self.parse( article ) date, title = map( parsed.get, [ 'date', 'title' ] ) month, day, year = map( date.get, [ 'month', 'date', 'year' ] ) filepath = schema.getFilePath( self.schemaName, parsed[ 'paper' ], month, day, year ) helpers.ensurePath( filepath ) filename = self.getFileName( title ) with open( filepath + "\\" + filename, 'w' ) as toFile: toFile.write( parsed[ 'body' ] ) return FilerResult( added = True, fileName = filename, filePath = filepath ) return FilerResult()
def getPath(): path = os.path.abspath( empiricalStore ) helpers.ensurePath( path ) return os.path.join( path, filename )