mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-11-24 03:16:57 +03:00
Fix for translated exception text.
This commit is contained in:
1 parent
9273e1e3d7
commit
68ea048ce5
3 files changed
+17
-12
No files matched your search
@@ -168,16 +168,16 @@ class AppWindow:
|
||||
flightlog.openlog()
|
||||
except Exception as e:
|
||||
if __debug__: print_exc()
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
|
||||
except companion.VerificationRequired:
|
||||
# don't worry about authentication now - prompt on query
|
||||
self.status['text'] = ''
|
||||
except companion.ServerError as e:
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
except Exception as e:
|
||||
if __debug__: print_exc()
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
self.cooldown()
|
||||
|
||||
# callback after verification code
|
||||
@@ -186,7 +186,7 @@ class AppWindow:
|
||||
self.session.verify(code)
|
||||
except Exception as e:
|
||||
if __debug__: print_exc()
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
else:
|
||||
return self.getandsend() # try again
|
||||
|
||||
@@ -298,7 +298,7 @@ class AppWindow:
|
||||
|
||||
# Companion API problem
|
||||
except companion.ServerError as e:
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
if play_sound: hotkeymgr.play_bad()
|
||||
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
@@ -313,7 +313,7 @@ class AppWindow:
|
||||
|
||||
except Exception as e:
|
||||
if __debug__: print_exc()
|
||||
self.status['text'] = str(e)
|
||||
self.status['text'] = unicode(e)
|
||||
if play_sound: hotkeymgr.play_bad()
|
||||
|
||||
self.cooldown()
|
||||
|
||||
+6
-2
@@ -99,12 +99,16 @@ def listify(thing):
|
||||
|
||||
|
||||
class ServerError(Exception):
|
||||
def __str__(self):
|
||||
def __unicode__(self):
|
||||
return _('Error: Server is down')
|
||||
def __str__(self):
|
||||
return unicode(self).encode('utf-8')
|
||||
|
||||
class CredentialsError(Exception):
|
||||
def __str__(self):
|
||||
def __unicode__(self):
|
||||
return _('Error: Invalid Credentials')
|
||||
def __str__(self):
|
||||
return unicode(self).encode('utf-8')
|
||||
|
||||
class VerificationRequired(Exception):
|
||||
pass
|
||||
|
||||
@@ -54,13 +54,14 @@ class Translations:
|
||||
|
||||
if __debug__:
|
||||
def translate(self, x):
|
||||
if x in self.translations:
|
||||
return self.translations[x]
|
||||
else:
|
||||
if not self.translations.get(x):
|
||||
print 'Missing translation: "%s"' % x
|
||||
return x
|
||||
else:
|
||||
return self.translations.get(x) or x
|
||||
else:
|
||||
def translate(self, x):
|
||||
return self.translations.get(x, x)
|
||||
return self.translations.get(x, x) or x
|
||||
|
||||
# Returns list of available language codes
|
||||
def available(self):
|
||||
|
||||
Reference in new issue
Block a user