From c5ed119f89b1c6ad2caa31f2cdc89fa5cc2c285a Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 26 Feb 2017 11:17:34 -0800 Subject: [PATCH] upload: Rename BadImageError exception to not mention avatars. This is preparation for using that function to decode realm icons as well. --- zerver/lib/upload.py | 2 +- zerver/tests/test_upload.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zerver/lib/upload.py b/zerver/lib/upload.py index 20b25b8451..3eeddcc0b6 100644 --- a/zerver/lib/upload.py +++ b/zerver/lib/upload.py @@ -90,7 +90,7 @@ def resize_avatar(image_data, size=DEFAULT_AVATAR_SIZE): im = Image.open(io.BytesIO(image_data)) im = ImageOps.fit(im, (size, size), Image.ANTIALIAS) except IOError: - raise BadImageError("Could not decode avatar image; did you upload an image file?") + raise BadImageError("Could not decode image; did you upload an image file?") out = io.BytesIO() im.save(out, format='png') return out.getvalue() diff --git a/zerver/tests/test_upload.py b/zerver/tests/test_upload.py index a19a20f5c5..638624c890 100644 --- a/zerver/tests/test_upload.py +++ b/zerver/tests/test_upload.py @@ -444,7 +444,7 @@ class AvatarTest(UploadSerializeMixin, ZulipTestCase): with get_test_image_file(fname) as fp: result = self.client_put_multipart("/json/users/me/avatar", {'file': fp}) - self.assert_json_error(result, "Could not decode avatar image; did you upload an image file?") + self.assert_json_error(result, "Could not decode image; did you upload an image file?") user_profile = get_user_profile_by_email("hamlet@zulip.com") self.assertEqual(user_profile.avatar_version, 1)