def _get_lines(self):
        try:
            if getsize(self.file_name) > 10000000:
                return 'File too big...'

            fh = file(self.file_name, 'rU')
            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_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 ( self ):
     try:
         return commatize( getsize( self.file_name ) ) + ' bytes'
     except:
         return ''
Beispiel #4
0
 def _get_size(self):
     try:
         return commatize(getsize(self.file_name)) + ' bytes'
     except:
         return ''