changeset 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 262d9d9ad27a
children 17bd09cd1001
files src/plugins/plugin_misc_account.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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)