diff src/plugins/plugin_xep_0054.py @ 765:787ee59dba9c

plugins radiocol, xep-0054: better handling of upload errors: - radiocolSongAdded is now asynchronous - _buildAvatar return a Failure if the image is not readable
author souliane <souliane@mailoo.org>
date Tue, 17 Dec 2013 18:44:53 +0100
parents 99eee75ec1b7
children bfabeedbf32e
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0054.py	Tue Dec 17 11:35:41 2013 +0100
+++ b/src/plugins/plugin_xep_0054.py	Tue Dec 17 18:44:53 2013 +0100
@@ -23,6 +23,7 @@
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber.xmlstream import IQ
 from twisted.words.xish import domish
+from twisted.python.failure import Failure
 import os.path
 
 from zope.interface import implements
@@ -236,7 +237,7 @@
         try:
             img = Image.open(filepath)
         except IOError:
-            raise exceptions.DataError("Can't open image")
+            return Failure(exceptions.DataError("Can't open image"))
 
         if img.size != (64, 64):
             img = img.resize((64, 64))