mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 01:38:55 +00:00
Move helper state to a separate function
This commit is contained in:
parent
332bd75fcc
commit
8b4c7296d7
@ -444,14 +444,7 @@ class RootElement(Element):
|
||||
(prefix, _, swissnum) = furl.rpartition("/")
|
||||
return "%s/[censored]" % (prefix,)
|
||||
|
||||
@renderer
|
||||
def helper_description(self, req, tag):
|
||||
if self.connected_to_helper(req, tag) == "no":
|
||||
return tag("Helper not connected")
|
||||
return tag("Helper")
|
||||
|
||||
@renderer
|
||||
def connected_to_helper(self, req, tag):
|
||||
def _connected_to_helper(self):
|
||||
try:
|
||||
uploader = self._client.getServiceNamed("uploader")
|
||||
except KeyError:
|
||||
@ -464,10 +457,19 @@ class RootElement(Element):
|
||||
return "yes"
|
||||
return "no"
|
||||
|
||||
@renderer
|
||||
def helper_description(self, req, tag):
|
||||
if self._connected_to_helper() == "no":
|
||||
return tag("Helper not connected")
|
||||
return tag("Helper")
|
||||
|
||||
@renderer
|
||||
def connected_to_helper(self, req, tag):
|
||||
return tag(self._connected_to_helper())
|
||||
|
||||
@renderer
|
||||
def connected_to_helper_alt(self, req, tag):
|
||||
state = self.connected_to_helper(req, tag)
|
||||
return self._connectedalts.get(state)
|
||||
return tag(self._connectedalts.get(self._connected_to_helper()))
|
||||
|
||||
def data_known_storage_servers(self, ctx, data):
|
||||
sb = self.client.get_storage_broker()
|
||||
|
Loading…
Reference in New Issue
Block a user