def make_mutable_file_uri(mdmf=False): if mdmf: uri = make_mdmf_mutable_file_cap() else: uri = make_mutable_file_cap() return uri.to_string()
def make_mutable_file_uri(mdmf=False): if mdmf: uri = make_mdmf_mutable_file_cap() else: uri = make_mutable_file_cap() return uri.to_string()
def list_directory(self, uri): api_uri = self.node_uri.child( u"uri", uri.to_string().decode("ascii"), ).add( u"t", u"json", ).to_uri().to_text().encode("ascii") action = start_action( action_type=u"magic-folder:cli:list-dir", filenode_uri=uri.to_string().decode("ascii"), api_uri=api_uri, ) with action.context(): response = yield self.agent.request( b"GET", api_uri, ) if response.code != 200: raise Exception( "Error response from list endpoint: {}".format(response)) kind, dirinfo = json.loads((yield readBody(response))) if kind != u"dirnode": raise ValueError( "Object is a {}, not a directory".format(kind)) action.add_success_fields(children=dirinfo[u"children"], ) returnValue({ name: ( Node( self, from_string( json_metadata.get( "rw_uri", json_metadata["ro_uri"]).encode("ascii"), ), ), json_metadata[u"metadata"], ) for (name, (child_kind, json_metadata)) in dirinfo[u"children"].items() })