From: Brian Warner <warner@allmydata.com>
Date: Thu, 29 Mar 2007 21:31:55 +0000 (-0700)
Subject: webish: add 'my nodeid' to the page
X-Git-Url: https://git.rkrishnan.org/pf/content/simplejson/frontends/-?a=commitdiff_plain;h=60bddba8275dcc8489cb8e2b39bcb2b05deed6ff;p=tahoe-lafs%2Ftahoe-lafs.git

webish: add 'my nodeid' to the page
---

diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
index 346b34de..67df5489 100644
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -1,9 +1,10 @@
 
+import os
 from twisted.trial import unittest
 from twisted.internet import defer, reactor
 from twisted.application import service
 from allmydata import client, queen
-import os
+from allmydata.util import idlib
 from foolscap.eventual import flushEventualQueue
 from twisted.python import log
 from twisted.web.client import getPage
@@ -171,6 +172,10 @@ class SystemTest(unittest.TestCase):
                             "I didn't see the right 'connected peers' message "
                             "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(lambda res: getPage(base + "vdrive/subdir1"))
         def _got_subdir1(page):
diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml
index 11006bf6..d15260aa 100644
--- a/src/allmydata/web/welcome.xhtml
+++ b/src/allmydata/web/welcome.xhtml
@@ -14,6 +14,7 @@
 
 <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>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>
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py
index f3f38de4..62a272b6 100644
--- a/src/allmydata/webish.py
+++ b/src/allmydata/webish.py
@@ -27,6 +27,8 @@ class Welcome(rend.Page):
     addSlash = True
     docFactory = getxmlfile("welcome.xhtml")
 
+    def data_my_nodeid(self, ctx, data):
+        return idlib.b2a(IClient(ctx).nodeid)
     def data_queen_pburl(self, ctx, data):
         return IClient(ctx).introducer_furl
     def data_connected_to_queen(self, ctx, data):