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) 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 try: s = client.getServiceNamed("storage") except KeyError: s = None self.putChild("storage", storage.StorageStatus(s, self.client.nickname)) 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())
def getChild(self, path, request): if path == "helper_status": # the Helper isn't attached until after the Tub starts, so this child # needs to created on each request return status.HelperStatus(self.client.helper) if path == "storage": # Storage isn't initialized until after the web hierarchy is # constructed so this child needs to be created later than # `__init__`. try: storage_server = self.client.getServiceNamed("storage") except KeyError: storage_server = None return storage.StorageStatus(storage_server, self.client.nickname)
def __init__(self, client, clock=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) try: s = client.getServiceNamed("storage") except KeyError: s = None self.child_storage = storage.StorageStatus(s) self.child_uri = URIHandler(client) self.child_cap = URIHandler(client) 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)