mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
Merge pull request #666 from tahoe-lafs/3264.late-bind-storage-for-web
Late bind storage child for the web api
This commit is contained in:
commit
f0d32a5123
0
newsfragments/3264.minor
Normal file
0
newsfragments/3264.minor
Normal file
@ -196,12 +196,6 @@ class Root(MultiFormatPage):
|
||||
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))
|
||||
@ -237,6 +231,16 @@ class Root(MultiFormatPage):
|
||||
# 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)
|
||||
|
||||
|
||||
# FIXME: This code is duplicated in root.py and introweb.py.
|
||||
def data_rendered_at(self, ctx, data):
|
||||
|
Loading…
Reference in New Issue
Block a user