[#2941] Remove tracker_status translation markup from core

* A UnicodeDecodeError can occur if creating a string using translated
   text but we should not be translating anything in core anyway so
   remove the markup and do the translating in UI.
This commit is contained in:
Calum Lind 2016-11-30 13:26:34 +00:00
commit 0b4627be8a
2 changed files with 5 additions and 5 deletions

View file

@ -91,7 +91,7 @@ def tracker_error_filter(torrent_ids, values):
# Check all the torrent's tracker_status for 'Error:' and only return torrent_ids # Check all the torrent's tracker_status for 'Error:' and only return torrent_ids
# that have this substring in their tracker_status # that have this substring in their tracker_status
for torrent_id in torrent_ids: for torrent_id in torrent_ids:
if _("Error") + ":" in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]: if "Error:" in tm[torrent_id].get_status(["tracker_status"])["tracker_status"]:
filtered_torrent_ids.append(torrent_id) filtered_torrent_ids.append(torrent_id)
return filtered_torrent_ids return filtered_torrent_ids

View file

@ -1014,7 +1014,7 @@ class TorrentManager(component.Component):
# Set the tracker status for the torrent # Set the tracker status for the torrent
if alert.message() != "Got peers from DHT": if alert.message() != "Got peers from DHT":
torrent.set_tracker_status(_("Announce OK")) torrent.set_tracker_status("Announce OK")
# Check to see if we got any peer information from the tracker # Check to see if we got any peer information from the tracker
if alert.handle.status().num_complete == -1 or \ if alert.handle.status().num_complete == -1 or \
@ -1030,7 +1030,7 @@ class TorrentManager(component.Component):
return return
# Set the tracker status for the torrent # Set the tracker status for the torrent
torrent.set_tracker_status(_("Announce Sent")) torrent.set_tracker_status("Announce Sent")
def on_alert_tracker_warning(self, alert): def on_alert_tracker_warning(self, alert):
log.debug("on_alert_tracker_warning") log.debug("on_alert_tracker_warning")
@ -1038,7 +1038,7 @@ class TorrentManager(component.Component):
torrent = self.torrents[str(alert.handle.info_hash())] torrent = self.torrents[str(alert.handle.info_hash())]
except: except:
return return
tracker_status = '%s: %s' % (_("Warning"), decode_string(alert.message())) tracker_status = '%s: %s' % ("Warning", decode_string(alert.message()))
# Set the tracker status for the torrent # Set the tracker status for the torrent
torrent.set_tracker_status(tracker_status) torrent.set_tracker_status(tracker_status)
@ -1055,7 +1055,7 @@ class TorrentManager(component.Component):
except (RuntimeError, KeyError): except (RuntimeError, KeyError):
return return
torrent.set_tracker_status("%s: %s" % (_("Error"), error_message)) torrent.set_tracker_status("Error: %s" % error_message)
def on_alert_storage_moved(self, alert): def on_alert_storage_moved(self, alert):
log.debug("on_alert_storage_moved") log.debug("on_alert_storage_moved")