plugins radiocol, xep-0054: better handling of upload errors:

- radiocolSongAdded is now asynchronous
- _buildAvatar return a Failure if the image is not readable
This commit is contained in:
souliane 2013-12-17 18:44:53 +01:00
commit b97f78ca93

View file

@ -23,6 +23,7 @@ from twisted.internet.defer import inlineCallbacks, returnValue
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 @@ class XEP_0054(object):
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))