From 3857a564a159da1f97b71d6bfbbb652165d5e8c6 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Mon, 24 Mar 2008 08:22:26 +0000 Subject: [PATCH] try to fix #89, by assuming name,tracker,tracker_status could be non-unicode --- plugins/WebUi/dbus_interface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/WebUi/dbus_interface.py b/plugins/WebUi/dbus_interface.py index 4743b77a0..cc70d42fe 100644 --- a/plugins/WebUi/dbus_interface.py +++ b/plugins/WebUi/dbus_interface.py @@ -91,7 +91,7 @@ class DbusManager(dbus.service.Object): torrent = self.core.unique_IDs[torrent_id] status = { - "name": state["name"], + "name": state["name"].decode('utf-8','ignore'), "total_size": state["total_size"], "num_pieces": state["num_pieces"], "state": state['state'], @@ -109,15 +109,16 @@ class DbusManager(dbus.service.Object): "eta": common.estimate_eta(state), "ratio": self.interface.manager.calc_ratio(torrent_id,state), #non 0.6 values follow here: - "tracker_status": state.get("tracker_status","?"), + "tracker_status": state.get("tracker_status","?").decode('utf-8','ignore'), "uploaded_memory": torrent.uploaded_memory, + "tracker":state["tracker"].decode('utf-8','ignore') } #more non 0.6 values for key in ["total_seeds", "total_peers","is_seed", "total_done", "total_download", "total_upload" #, "download_rate","upload_rate" , "num_files", "piece_length", "distributed_copies" - ,"next_announce","tracker","queue_pos"]: + ,"next_announce","queue_pos"]: status[key] = state[key] #print 'all_keys:',sorted(status.keys())