From 611178490aad421a082ad959d3337c216dbd889f Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Tue, 27 Mar 2007 17:44:49 -0700
Subject: [PATCH] fix some python2.5 incompatibilities, and remove an old
 webish display that suggested we might know about peers but not be connected
 to them

---
 src/allmydata/test/test_system.py | 5 +++--
 src/allmydata/web/welcome.xhtml   | 3 +--
 src/allmydata/webish.py           | 4 +---
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py
index 709390ed..346b34de 100644
--- a/src/allmydata/test/test_system.py
+++ b/src/allmydata/test/test_system.py
@@ -89,7 +89,8 @@ class SystemTest(unittest.TestCase):
 
     def wait_for_connections(self, ignored=None):
         for c in self.clients:
-            if not c.introducer_client or len(c.get_all_peerids()) != self.numclients:
+            if (not c.introducer_client or
+                len(list(c.get_all_peerids())) != self.numclients):
                 d = defer.Deferred()
                 d.addCallback(self.wait_for_connections)
                 reactor.callLater(0.05, d.callback, None)
@@ -103,7 +104,7 @@ class SystemTest(unittest.TestCase):
         def _check(extra_node):
             self.extra_node = extra_node
             for c in self.clients:
-                self.failUnlessEqual(len(c.get_all_peerids()), 6)
+                self.failUnlessEqual(len(list(c.get_all_peerids())), 6)
         d.addCallback(_check)
         def _shutdown_extra_node(res):
             if self.extra_node:
diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml
index 5d8ad3b8..11006bf6 100644
--- a/src/allmydata/web/welcome.xhtml
+++ b/src/allmydata/web/welcome.xhtml
@@ -16,8 +16,7 @@
 
 <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 Peers: <span n:render="string" n:data="num_peers" /></div>
-<div>Connected Peers: <span n:render="string" n:data="num_connected_peers" /></div>
+<div>Known+Connected Peers: <span n:render="string" n:data="num_peers" /></div>
 
 <div>
 <table n:render="sequence" n:data="peers" border="1">
diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py
index ca86f61e..f3f38de4 100644
--- a/src/allmydata/webish.py
+++ b/src/allmydata/webish.py
@@ -36,9 +36,7 @@ class Welcome(rend.Page):
     def data_num_peers(self, ctx, data):
         #client = inevow.ISite(ctx)._client
         client = IClient(ctx)
-        return len(client.get_all_peerids())
-    def data_num_connected_peers(self, ctx, data):
-        return len(IClient(ctx).get_all_peerids())
+        return len(list(client.get_all_peerids()))
 
     def data_peers(self, ctx, data):
         d = []
-- 
2.45.2