(self, src, dest)
Copy a file in local mode, or download from the fileserver in push mode
Copy a file in local mode, or download from the fileserver in push mode
Copy a file in local mode or download from the fileserver in push mode
def copy_file(self, src, dest):
        """
        Copy a file in local mode, or download from the fileserver in push mode
        """
        caller = Context().caller()
        if caller:
            bio = open(dest, "wb", buffering=0)     
            if not src.startswith('/'):    
                src = os.path.join(Context().relative_root(), src)
            ok, metadata = mitogen.service.FileService.get(caller, src, bio)
            if not ok:
               raise Exception("file transfer failed")
        else:
            shutil.copy2(src, dest)
def copy_file ( self , src , dest ) : caller = Context ( ) . caller ( ) if caller : bio = open ( dest , "wb" , buffering = 0 ) if not src . startswith ( '/' ) : src = os . path . join ( Context ( ) . relative_root ( ) , src ) ok , metadata = mitogen . service . FileService . get ( caller , src , bio ) if not ok : raise Exception ( "file transfer failed" ) else : shutil . copy2 ( src , dest )