comparison src/core/sat_main.py @ 1063:6ec513ad92c2

frontends: async failures are more detailed (full class name + error message)
author souliane <souliane@mailoo.org>
date Sat, 07 Jun 2014 15:39:20 +0200
parents b2b9c184033f
children b29452cab50b
comparison
equal deleted inserted replaced
1062:95758ef3faa8 1063:6ec513ad92c2
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from sat.core.i18n import _, languageSwitch 20 from sat.core.i18n import _, D_, languageSwitch
21 from twisted.application import service 21 from twisted.application import service
22 from twisted.internet import defer 22 from twisted.internet import defer
23 from twisted.words.protocols.jabber import jid 23 from twisted.words.protocols.jabber import jid
24 from twisted.words.xish import domish 24 from twisted.words.xish import domish
25 from twisted.internet import reactor 25 from twisted.internet import reactor
296 return defer.succeed(None) 296 return defer.succeed(None)
297 297
298 def check_result(result): 298 def check_result(result):
299 if not result: 299 if not result:
300 log.warning(_('Authentication failure of profile %s') % profile) 300 log.warning(_('Authentication failure of profile %s') % profile)
301 raise exceptions.PasswordError(_("The provided profile password doesn't match.")) 301 raise exceptions.PasswordError(D_("The provided profile password doesn't match."))
302 if not session_data: # avoid to create two profile sessions when password if specified 302 if not session_data: # avoid to create two profile sessions when password if specified
303 return self.memory.newAuthSession(password, profile) 303 return self.memory.newAuthSession(password, profile)
304 304
305 d = self.memory.asyncGetParamA(C.PROFILE_PASS_PATH[1], C.PROFILE_PASS_PATH[0], profile_key=profile) 305 d = self.memory.asyncGetParamA(C.PROFILE_PASS_PATH[1], C.PROFILE_PASS_PATH[0], profile_key=profile)
306 d.addCallback(lambda sat_cipher: PasswordHasher.verify(password, sat_cipher)) 306 d.addCallback(lambda sat_cipher: PasswordHasher.verify(password, sat_cipher))