Module: deluge
Branch: master
Commit: 7e7da94a6eb5a90b3fa0a4bb128187d3f8cf0d44

Author: Damien Churchill <[email protected]>
Date:   Mon May  3 20:52:38 2010 +0100

fix the Tracker resource for the webui

---

 deluge/ui/web/server.py |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
index 261836c..f6a4d13 100644
--- a/deluge/ui/web/server.py
+++ b/deluge/ui/web/server.py
@@ -194,22 +194,23 @@ class Tracker(resource.Resource):
         request.tracker_name = path
         return self
 
-    def render(self, request):
-        def on_get_icon(icon):
-            headers = {}
-            if icon:
-                request.setHeader("cache-control",
-                                  "public, must-revalidate, max-age=86400")
-                request.setHeader("content-type", icon.get_mimetype())
-                request.setResponseCode(http.OK)
-                return icon.get_data()
-            else:
-                request.setResponseCode(http.NOT_FOUND)
-                return ""
+    def on_got_icon(self, icon, request):
+        headers = {}
+        if icon:
+            request.setHeader("cache-control",
+                              "public, must-revalidate, max-age=86400")
+            request.setHeader("content-type", icon.get_mimetype())
+            request.setResponseCode(http.OK)
+            request.write(icon.get_data())
+            request.finish()
+        else:
+            request.setResponseCode(http.NOT_FOUND)
+            request.finish()
 
+    def render(self, request):
         d = self.tracker_icons.get(request.tracker_name)
-        d.addCallback(on_get_icon)
-        return d
+        d.addCallback(self.on_got_icon, request)
+        return server.NOT_DONE_YET
 
 class Flag(resource.Resource):
     def getChild(self, path, request):

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to