webish: add 'my nodeid' to the page
authorBrian Warner <warner@allmydata.com>
Thu, 29 Mar 2007 21:31:55 +0000 (14:31 -0700)
committerBrian Warner <warner@allmydata.com>
Thu, 29 Mar 2007 21:31:55 +0000 (14:31 -0700)
src/allmydata/test/test_system.py
src/allmydata/web/welcome.xhtml
src/allmydata/webish.py

index 346b34dedf9a34085249a6627b56427496d6231a..67df54893f24efbb8ba54cbc7d0c2af5a5053ef0 100644 (file)
@@ -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):
index 11006bf68ea7c26e5dd8e8eff341b9d417221f5a..d15260aa0ec930da9f1d872190a3b416559f91e7 100644 (file)
@@ -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>
index f3f38de413b24b2ac3170ba781383099ff09dbcb..62a272b6a90eff500a710039ba7cb6acba3da9d7 100644 (file)
@@ -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):