webish: add 'my nodeid' to the page

This commit is contained in:
Brian Warner 2007-03-29 14:31:55 -07:00
parent c70b4773d3
commit 60bddba827
3 changed files with 9 additions and 1 deletions

View File

@ -1,9 +1,10 @@
import os
from twisted.trial import unittest from twisted.trial import unittest
from twisted.internet import defer, reactor from twisted.internet import defer, reactor
from twisted.application import service from twisted.application import service
from allmydata import client, queen from allmydata import client, queen
import os from allmydata.util import idlib
from foolscap.eventual import flushEventualQueue from foolscap.eventual import flushEventualQueue
from twisted.python import log from twisted.python import log
from twisted.web.client import getPage from twisted.web.client import getPage
@ -171,6 +172,10 @@ class SystemTest(unittest.TestCase):
"I didn't see the right 'connected peers' message " "I didn't see the right 'connected peers' message "
"in: %s" % page "in: %s" % page
) )
expected = "My nodeid: <span>%s</span>" % idlib.b2a(self.clients[0].nodeid)
self.failUnless(expected in page,
"I didn't see the right 'My nodeid' message "
"in: %s" % page)
d.addCallback(_got_welcome) d.addCallback(_got_welcome)
d.addCallback(lambda res: getPage(base + "vdrive/subdir1")) d.addCallback(lambda res: getPage(base + "vdrive/subdir1"))
def _got_subdir1(page): def _got_subdir1(page):

View File

@ -14,6 +14,7 @@
<h2>Mesh Status</h2> <h2>Mesh Status</h2>
<div>My nodeid: <span n:render="string" n:data="my_nodeid" /></div>
<div>Queen: <span n:render="string" n:data="queen_pburl" /></div> <div>Queen: <span n:render="string" n:data="queen_pburl" /></div>
<div>Connected to queen?: <span n:render="string" n:data="connected_to_queen" /></div> <div>Connected to queen?: <span n:render="string" n:data="connected_to_queen" /></div>
<div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div> <div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div>

View File

@ -27,6 +27,8 @@ class Welcome(rend.Page):
addSlash = True addSlash = True
docFactory = getxmlfile("welcome.xhtml") docFactory = getxmlfile("welcome.xhtml")
def data_my_nodeid(self, ctx, data):
return idlib.b2a(IClient(ctx).nodeid)
def data_queen_pburl(self, ctx, data): def data_queen_pburl(self, ctx, data):
return IClient(ctx).introducer_furl return IClient(ctx).introducer_furl
def data_connected_to_queen(self, ctx, data): def data_connected_to_queen(self, ctx, data):