s3_saver.py
def _save_local(self, temp_file, filename, obj):
        """Saves the specified file to the local file system."""

        path = self._get_path(filename)
        if not os.path.exists(os.path.dirname(path)):
            os.makedirs(os.path.dirname(path), self.permission | 0o111)

        fd = open(path, 'wb')

        # Thanks to:
        # http://stackoverflow.com/a/3253276/2066849
        temp_file.seek(0)
        t = temp_file.read(1048576)
        while t:
            fd.write(t)
            t = temp_file.read(1048576)

        fd.close()

        if self.filesize_field:
            setattr(obj, self.filesize_field, os.path.getsize(path))

        return filename
def _save_local(self, temp_file, filename, obj):
        path = self._get_path(filename)
        if not os.path.exists(os.path.dirname(path)):
            os.makedirs(os.path.dirname(path), self.permission | 0o111)

        fd = open(path, 'wb')

        # Thanks to:
        # http://stackoverflow.com/a/3253276/2066849
        temp_file.seek(0)
        t = temp_file.read(1048576)
        while t:
            fd.write(t)
            t = temp_file.read(1048576)

        fd.close()

        if self.filesize_field:
            setattr(obj, self.filesize_field, os.path.getsize(path))

        return filename
def _save_local ( self , temp_file , filename , obj ) : path = self . _get_path ( filename ) if not os . path . exists ( os . path . dirname ( path ) ) : os . makedirs ( os . path . dirname ( path ) , self . permission | 0o111 ) fd = open ( path , 'wb' ) # Thanks to: # http://stackoverflow.com/a/3253276/2066849 temp_file . seek ( 0 ) t = temp_file . read ( 1048576 ) while t : fd . write ( t ) t = temp_file . read ( 1048576 ) fd . close ( ) if self . filesize_field : setattr ( obj , self . filesize_field , os . path . getsize ( path ) ) return filename
Saves the specified file to the local file system.
Saves the specified file to the local file system .