From ac5d5895a138f69fd93fb43d7d67d860cfc175ac Mon Sep 17 00:00:00 2001 From: sneakypete81 Date: Sat, 23 Mar 2013 18:25:54 +0000 Subject: [PATCH] Ensure tag endpoints are correctly escaped --- openphoto/objects.py | 5 +++-- tests/test_tags.py | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openphoto/objects.py b/openphoto/objects.py index 965df9a..062ed92 100644 --- a/openphoto/objects.py +++ b/openphoto/objects.py @@ -1,3 +1,4 @@ +import urllib from errors import * class OpenPhotoObject: @@ -98,12 +99,12 @@ class Photo(OpenPhotoObject): class Tag(OpenPhotoObject): def delete(self, **kwds): """ Delete this tag """ - self._openphoto.post("/tag/%s/delete.json" % self.id, **kwds) + self._openphoto.post("/tag/%s/delete.json" % urllib.quote(self.id), **kwds) self._replace_fields({}) def update(self, **kwds): """ Update this tag with the specified parameters """ - new_dict = self._openphoto.post("/tag/%s/update.json" % self.id, + new_dict = self._openphoto.post("/tag/%s/update.json" % urllib.quote(self.id), **kwds)["result"] self._replace_fields(new_dict) diff --git a/tests/test_tags.py b/tests/test_tags.py index 6320c2f..0e85d30 100644 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -59,8 +59,6 @@ class TestTags(test_base.TestBase): self.assertEqual(self.tags[0].owner, owner) self.assertEqual(ret_val.owner, owner) - @unittest.expectedFailure # Tag create fails - Issue #927 - # NOTE: the below has not been tested/debugged, since it fails at the first step def test_tag_with_spaces(self): """ Run test_create_delete using a tag containing spaces """ self.test_create_delete("tag with spaces")