diff src/browser/sat_browser/radiocol.py @ 481:bbdc5357dc00

browser and server sides: refactor HTTP request result values + handle "NoReply" error
author souliane <souliane@mailoo.org>
date Sun, 15 Jun 2014 17:52:08 +0200
parents 97c72fe4a5f2
children
line wrap: on
line diff
--- a/src/browser/sat_browser/radiocol.py	Sat Jun 14 19:20:27 2014 +0200
+++ b/src/browser/sat_browser/radiocol.py	Sun Jun 15 17:52:08 2014 +0200
@@ -22,6 +22,7 @@
 log = getLogger(__name__)
 from sat_frontends.tools.misc import DEFAULT_MUC
 from sat.core.i18n import _
+from constants import Const as C
 
 from pyjamas.ui.VerticalPanel import VerticalPanel
 from pyjamas.ui.HorizontalPanel import HorizontalPanel
@@ -161,17 +162,17 @@
 
     def onSubmitComplete(self, event):
         result = event.getResults()
-        if result == "OK":
+        if result == C.UPLOAD_OK:
             # the song can still be rejected (not readable, full queue...)
             self.setTemporaryStatus('[Your song has been submitted to the radio]', "ok")
-        elif result == "KO":
+        elif result == C.UPLOAD_KO:
             self.setTemporaryStatus('[Something went wrong during your song upload]', "ko")
             self._parent.radiocolSongRejected(_("The uploaded file has been rejected, only Ogg Vorbis and MP3 songs are accepted."))
             # TODO: would be great to re-use the original Exception class and message
             # but it is lost in the middle of the traceback and encapsulated within
             # a DBusException instance --> extract the data from the traceback?
         else:
-            Window.alert('Submit error: %s' % result)
+            Window.alert(_('Submit error: %s' % result))
             self.status.setText('')