diff src/plugins/plugin_misc_account.py @ 644:53de6954e94e

plugin misc_account: fix for sending a failure message
author souliane <souliane@mailoo.org>
date Sun, 08 Sep 2013 14:59:14 +0200
parents 49587e170f53
children 712e3782af12
line wrap: on
line diff
--- a/src/plugins/plugin_misc_account.py	Sat Sep 07 19:50:12 2013 +0200
+++ b/src/plugins/plugin_misc_account.py	Sun Sep 08 14:59:14 2013 +0200
@@ -22,6 +22,7 @@
 from twisted.internet import reactor, defer, protocol
 from os.path import join, dirname
 from twisted.python.procutils import which
+from twisted.python.failure import Failure
 from email.mime.text import MIMEText
 from twisted.mail.smtp import sendmail
 
@@ -73,7 +74,7 @@
             self.deferred.callback(None)
         else:
             error(_(u"Can't register Prosody account (error code: %(code)d): %(message)s") % {'code': reason.value.exitCode, 'message': self.data})
-            self.deferred.errback("INTERNAL")
+            self.deferred.errback(Failure(u"INTERNAL"))
 
 
 class MiscAccount(object):
@@ -108,7 +109,7 @@
             raise exceptions.DataError
 
         if profile.lower() in RESERVED:
-            return defer.fail('CONFLICT')
+            return defer.fail(Failure(u'CONFLICT'))
 
         d = self.host.memory.asyncCreateProfile(profile)
         d.addCallback(self._profileRegistered, email, password, profile)