From ea904e4337e5d74976bddcc3f36330411b4aea38 Mon Sep 17 00:00:00 2001 From: sneakypete81 Date: Sat, 13 Apr 2013 13:11:26 +0100 Subject: [PATCH] Not that frontend issue 955 is resolved, we should use the return value of the transform API to replace the photo object's fields --- openphoto/api_photo.py | 4 +--- openphoto/objects.py | 6 ++---- tests/test_photos.py | 10 ---------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/openphoto/api_photo.py b/openphoto/api_photo.py index 6e26ea8..18ae68c 100644 --- a/openphoto/api_photo.py +++ b/openphoto/api_photo.py @@ -111,6 +111,4 @@ class ApiPhoto: if not isinstance(photo, Photo): photo = Photo(self._client, {"id": photo}) photo.transform(**kwds) - # The API doesn't currently return the transformed photo - # Uncomment the below once frontend issue #955 is resolved -# return photo + return photo diff --git a/openphoto/objects.py b/openphoto/objects.py index 17484f5..1d09f43 100644 --- a/openphoto/objects.py +++ b/openphoto/objects.py @@ -98,14 +98,12 @@ class Photo(OpenPhotoObject): def transform(self, **kwds): """ - Performs transformation specified in **kwds + Performs transformation specified in **kwds Example: transform(rotate=90) """ new_dict = self._openphoto.post("/photo/%s/transform.json" % self.id, **kwds)["result"] - # The API doesn't currently return the transformed photo - # Uncomment the below once frontend issue #955 is resolved -# self._replace_fields(new_dict) + self._replace_fields(new_dict) class Tag(OpenPhotoObject): def delete(self, **kwds): diff --git a/tests/test_photos.py b/tests/test_photos.py index 8c48e53..0050298 100644 --- a/tests/test_photos.py +++ b/tests/test_photos.py @@ -151,18 +151,8 @@ class TestPhotos(test_base.TestBase): photo = self.photos[0] self.assertEqual(photo.rotation, "0") photo = self.client.photo.transform(photo, rotate=90) - - # Need an explicit update, since transform API doesn't return the rotated photo - # Remove the following line once Issue #955 is resolved - photo = self.client.photo.view(self.photos[0]) - self.assertEqual(photo.rotation, "90") # Do the same using the Photo object directly photo.transform(rotate=90) - - # Need an explicit update, since transform API doesn't return the rotated photo - # Remove the following line once Issue #955 is resolved - photo = self.client.photo.view(photo) - self.assertEqual(photo.rotation, "180")