def _get_lines ( self ): try: if getsize( self.file_name ) > 10000000: return 'File too big...' fh = file( self.file_name, 'rb' ) data = fh.read() fh.close() except: return '' if ( data.find( '\x00' ) >= 0 ) or ( data.find( '\xFF' ) >= 0 ): return 'File contains binary data...' return ( '%s lines' % commatize( len( data.splitlines() ) ) )
def _get_size_text ( self ): return commatize( self.item.size )