(self, src, remote=False)
Read a file into memory,  use the fileserver if in push mode, otherwise just use the filesystem.
Read a file into memory,  use the fileserver if in push mode, otherwise just use the filesystem.
Read a file into memory use the fileserver if in push mode otherwise just use the filesystem .
def slurp(self, src, remote=False):
        """
        Read a file into memory,  use the fileserver if in push mode, otherwise just use the filesystem.
        """
        caller = Context().caller()
        if caller and remote:
            bio = io.BytesIO()
            if not src.startswith('/'):    
                src = os.path.join(Context().relative_root(), src)
            ok, metadata = mitogen.service.FileService.get(caller, src, bio)
            data = bio.getvalue().decode('utf-8')
            bio.close()
            return data
        else:
            fd = open(src)
            data = fd.read()
            fd.close()
            return data
def slurp ( self , src , remote = False ) : caller = Context ( ) . caller ( ) if caller and remote : bio = io . BytesIO ( ) if not src . startswith ( '/' ) : src = os . path . join ( Context ( ) . relative_root ( ) , src ) ok , metadata = mitogen . service . FileService . get ( caller , src , bio ) data = bio . getvalue ( ) . decode ( 'utf-8' ) bio . close ( ) return data else : fd = open ( src ) data = fd . read ( ) fd . close ( ) return data