Ensure tag endpoints are correctly escaped

This commit is contained in:
sneakypete81 2013-03-23 18:25:54 +00:00
parent b56e690d33
commit ac5d5895a1
2 changed files with 3 additions and 4 deletions

View file

@ -1,3 +1,4 @@
import urllib
from errors import * from errors import *
class OpenPhotoObject: class OpenPhotoObject:
@ -98,12 +99,12 @@ class Photo(OpenPhotoObject):
class Tag(OpenPhotoObject): class Tag(OpenPhotoObject):
def delete(self, **kwds): def delete(self, **kwds):
""" Delete this tag """ """ 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({}) self._replace_fields({})
def update(self, **kwds): def update(self, **kwds):
""" Update this tag with the specified parameters """ """ 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"] **kwds)["result"]
self._replace_fields(new_dict) self._replace_fields(new_dict)

View file

@ -59,8 +59,6 @@ class TestTags(test_base.TestBase):
self.assertEqual(self.tags[0].owner, owner) self.assertEqual(self.tags[0].owner, owner)
self.assertEqual(ret_val.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): def test_tag_with_spaces(self):
""" Run test_create_delete using a tag containing spaces """ """ Run test_create_delete using a tag containing spaces """
self.test_create_delete("tag with spaces") self.test_create_delete("tag with spaces")