From: Brian Warner <warner@allmydata.com>
Date: Thu, 27 Mar 2008 01:20:07 +0000 (-0700)
Subject: web-status: client methods like list_all_uploads() return Upload instances,
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/reliability?a=commitdiff_plain;h=04b690ac9ec239e38f749730b8755b826529d601;p=tahoe-lafs%2Ftahoe-lafs.git

web-status: client methods like list_all_uploads() return Upload instances,
not status instances. Fix this. The symptom was that following a link like
'up-123' that referred to an old operation (no longer in memory) while an
upload was active would get an ugly traceback instead of a "no such resource"
message.
---

diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py
index 8203e5b1..64e69fa5 100644
--- a/src/allmydata/web/status.py
+++ b/src/allmydata/web/status.py
@@ -729,28 +729,33 @@ class Status(rend.Page):
             for s in client.list_recent_uploads():
                 if s.get_counter() == count:
                     return UploadStatusPage(s)
-            for s in client.list_all_uploads():
+            for u in client.list_all_uploads():
+                # u is an uploader object
+                s = u.get_upload_status()
                 if s.get_counter() == count:
                     return UploadStatusPage(s)
         if stype == "down":
             for s in client.list_recent_downloads():
                 if s.get_counter() == count:
                     return DownloadStatusPage(s)
-            for s in client.list_all_downloads():
+            for d in client.list_all_downloads():
+                s = d.get_download_status()
                 if s.get_counter() == count:
                     return DownloadStatusPage(s)
         if stype == "publish":
             for s in client.list_recent_publish():
                 if s.get_counter() == count:
                     return PublishStatusPage(s)
-            for s in client.list_all_publish():
+            for p in client.list_all_publish():
+                s = p.get_status()
                 if s.get_counter() == count:
                     return PublishStatusPage(s)
         if stype == "retrieve":
             for s in client.list_recent_retrieve():
                 if s.get_counter() == count:
                     return RetrieveStatusPage(s)
-            for s in client.list_all_retrieve():
+            for r in client.list_all_retrieve():
+                s = r.get_status()
                 if s.get_counter() == count:
                     return RetrieveStatusPage(s)