def __init__(self, client, clock=None, now_fn=None): """ Render root page ("/") of the URI. :client allmydata.client._Client: a stats provider. :clock: unused here. :now_fn: a function that returns current time. """ super(Root, self).__init__() self._client = client self._now_fn = now_fn self.putChild("uri", URIHandler(client)) self.putChild("cap", URIHandler(client)) # Handler for everything beneath "/private", an area of the resource # hierarchy which is only accessible with the private per-node API # auth token. self.putChild("private", create_private_tree(client.get_auth_token)) self.putChild("file", FileHandler(client)) self.putChild("named", FileHandler(client)) self.putChild("status", status.Status(client.get_history())) self.putChild("statistics", status.Statistics(client.stats_provider)) static_dir = resource_filename("allmydata.web", "static") for filen in os.listdir(static_dir): self.putChild(filen, static.File(os.path.join(static_dir, filen))) self.putChild("report_incident", IncidentReporter())
def __init__(self, client, clock=None, now_fn=None): rend.Page.__init__(self, client) self.client = client # If set, clock is a twisted.internet.task.Clock that the tests # use to test ophandle expiration. self.child_operations = operations.OphandleTable(clock) self.now_fn = now_fn try: s = client.getServiceNamed("storage") except KeyError: s = None self.child_storage = storage.StorageStatus(s, self.client.nickname) self.child_uri = URIHandler(client) self.child_cap = URIHandler(client) # handler for "/magic_folder" URIs self.child_magic_folder = magic_folder.MagicFolderWebApi(client) # Handler for everything beneath "/private", an area of the resource # hierarchy which is only accessible with the private per-node API # auth token. self.child_private = create_private_tree(client.get_auth_token) self.child_file = FileHandler(client) self.child_named = FileHandler(client) self.child_status = status.Status(client.get_history()) self.child_statistics = status.Statistics(client.stats_provider) static_dir = resource_filename("allmydata.web", "static") for filen in os.listdir(static_dir): self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
def __init__(self, client, clock=None, now_fn=None): rend.Page.__init__(self, client) self.client = client self.now_fn = now_fn self.putChild("uri", URIHandler(client)) self.putChild("cap", URIHandler(client)) # handler for "/magic_folder" URIs self.putChild("magic_folder", magic_folder.MagicFolderWebApi(client)) # Handler for everything beneath "/private", an area of the resource # hierarchy which is only accessible with the private per-node API # auth token. self.putChild("private", create_private_tree(client.get_auth_token)) self.putChild("file", FileHandler(client)) self.putChild("named", FileHandler(client)) self.putChild("status", status.Status(client.get_history())) self.putChild("statistics", status.Statistics(client.stats_provider)) static_dir = resource_filename("allmydata.web", "static") for filen in os.listdir(static_dir): self.putChild(filen, nevow_File(os.path.join(static_dir, filen))) self.putChild("report_incident", IncidentReporter())